1. Go to this page and download the library: Download php-enspired/peekaboo library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
php-enspired / peekaboo example snippets
use at\peekaboo\ {
HasMessages,
MessageMapper
};
class Foo implements HasMessages {
use MessageMapper;
}
$formatted = new Foo()->makeMessage("foo.welcome", ["place" => "jungle"]);
// Welcome to the jungle, we've got fun and games
use at\peekaboo\MessageBundle;
$myBundle = new MessageBundle(["welcome-user" => "Welcome to the {place}, {name}!"]);
echo MessageRegistry::messageFrom($myBundle, "welcome-user", ["name" => "Adrian", "place" => "jungle"]);
// Welcome to the jungle, Adrian!
class Foo implements HasMessages {
use MessageMapper;
public const array MESSAGES = [
"foo" => [
"welcome" => "Welcome to the {place}, we've got fun and games"
]
];
}
new Foo()->makeMessage("foo.welcome", ["place" => "jungle"]);
// Welcome to the jungle, we've got fun and games
use at\peekaboo\MessageEnum;
enum Woo : string implements EnumeratesMessages {
use MessageEnum;
case Welcome = "Welcome to the {place}, we've got fun and games";
}
Woo::Welcome->message(["place" => "jungle"]);
// Welcome to the jungle, we've got fun and games
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.