commit dea0fc522840cb5a1b55f8c2e56d110c1cc5e7b7 Author: Christopher Vagnetoft Date: Thu Mar 17 00:11:31 2016 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..22d0d82 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +vendor diff --git a/README.md b/README.md new file mode 100644 index 0000000..f256bbd --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +noccylabs/unicode +================= + +This library adds support for writing unicode characters to the console. It will +register a number of global functions for this purpose: + + * `uchr($numeric)` - Returns the unicode character matching the numeric argument. + * `uprintf($fmt, $arg..)` - A wrapper for `printf` that enables `\u` to embed + unicode strings. + * `usprintf($fmt, $arg..)` - A wrapper like `uprintf` but for `sprintf`. + + +## Examples + +To output a specific UTF-8 glyph: + + echo uchr(0x1000) + +The same thing in a printf fashion: + + uprintf("Unicode glyph x1000: \u1000"); + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..dc653ee --- /dev/null +++ b/composer.json @@ -0,0 +1,18 @@ +{ + "name": "noccylabs/unicode", + "description": "Functions to output unicode characters to the console", + "type": "library", + "license": "GPL-3.0", + "authors": [ + { + "name": "Christopher Vagnetoft", + "email": "cvagnetoft@gmail.com" + } + ], + "require": {}, + "autoload": { + "files": [ + "lib/unicode.php" + ] + } +} diff --git a/examples/unicode.php b/examples/unicode.php new file mode 100644 index 0000000..feb9877 --- /dev/null +++ b/examples/unicode.php @@ -0,0 +1,13 @@ +