clue/caret-notation

^B A dead-simple PHP library to add caret notation in order to safely show strings that contain ASCII control characters (unprintable characters)

Maintainers

👁 clue

Package info

github.com/clue/php-caret-notation

pkg:composer/clue/caret-notation

Statistics

Installs: 6 228

Dependents: 1

Suggesters: 0

Stars: 2

Open Issues: 2

v0.2.0 2015-06-19 18:29 UTC

Requires

  • php: >=5.3

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 30d4542b758d8a81eaaf441adf45ed254792cd3d

  • Christian Lück <christian.woop@lueck.tv>

encodingasciibinaryhexdumpcontrol characterscaret notation

This package is auto-updated.

Last update: 2026-06-06 13:22:29 UTC


README

^B A dead-simple PHP library to add caret notation in order to safely show strings that contain ASCII control characters (unprintable characters)

Quickstart example

Once installed, you can use the following code to use caret notation for any string that (may possibly) contain binary control characters:

$encoder = new Encoder();

$string = "Hello\r\nworld\0";
// Output: Hello^M^Jworld^@
echo $encoder->encode($string);

$string = "No control chars";
// Output: No control chars
echo $encoder->encode($string);

Install

The recommended way to install this library is through composer. New to composer?

{
 "require": {
 "clue/caret-notation": "~0.2.0"
 }
}

License

MIT