php-enspired / peekaboo
message formatting utilities using ICU, with a fallback on basic string templating.
v1.0
2024-03-14 22:35 UTC
Requires
- php: ^8.1
Requires (Dev)
- phan/phan: ^5.4.3
- phpunit/phpunit: ^10
Suggests
- ext-intl: provides support for ICU formatting and message bundle support
This package is auto-updated.
Last update: 2025-02-15 00:46:17 UTC
README
peekaboo! (ICU)
peekaboo provides message formatting utilities using International Components for Unicode, with a fallback on basic string templating.
dependencies
Requires php 8.1 or later.
ICU support requires the intl
extension.
Building ICU resource bundles uses genrb
.
installation
Recommended installation method is via Composer: simply composer require php-enspired/peekaboo
.
for starters
use at\peekaboo\ { HasMessages, MakesMessages }; class Foo implements HasMessages { use MakesMessages; public const MESSAGES = [ "welcome" => "welcome to the {place}, we've got fun and games" ]; } echo (new Foo())->makeMessage("welcome", ["place" => "jungle"]); // welcome to the jungle, we've got fun and games
docs
tests
Run static analysis with composer test:analyze
Run unit tests with composer test:unit
contributing or getting help
I'm on IRC at libera#php-enspired
, or open an issue on github. Feedback is welcomed as well.