Download the PHP package php-enspired/peekaboo without Composer

On this page you can find all versions of the php package php-enspired/peekaboo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package peekaboo

   

peekaboo! (ICU)

peekaboo provides message formatting utilities using International Components for Unicode, with a fallback on basic string templating.

dependencies

Requires php 8.3 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

message registry

Where did that message come from? peekaboo provides a registry for your application to store, lookup, and format messages. You can register any intl ResourceBundle, either available by default or under a named group, and get formatted messages by passing the message key and substitution context.

If a message key is not found under the specified group name, peekaboo falls back on looking in the default registries. You can also set a default locale (used when $locale is not provided for a specific message) by assigning to MessageRegistry::$defaultLocale.

If users.namebadge was found in the ja_JP locale, in either the "user" or the default registers, the above might return something like:

こんにちは、私の名前はAdrianです

If no matching formatting string was found in the ja_JP locale, peekaboo would fall back on the default locale and we might see something like:

Hello, my name is Adrian

For convenience, MessageRegistry::message() is available via a proxy function at\peekaboo\_, so the following is functionally the same as above:

To avoid the fallback behavior and look for messages only from a specific bundle (whether registered or not), use ::messageFrom() instead:

The message registry can also work with peekaboo's own MessageBundle class, which, like intl's ResourceBundle, is a container for message format strings. These are loaded from a php array, however, rather than an ICU resource file. As the name implies, only message formats are handled (not any other resource type).

messages without a registry

peekaboo allows classes to declare their own message formatting strings, either as a fallback if no matching message is registered or where there is simply no need to support multiple locales.

There are two ways to declare message formatting strings on a class. First, your class can define formats on the MESSAGES array. This is useful as a fallback for messages that aren't registered:

Or, you can use an enum to hold message formats with the MessageEnum trait. This provides a method message() which is equivalent to makesMessage() but does not take a key (since none is needed):

This is a subtle difference, but is worth calling out: when you use EnumeratesMessages->message(), peekaboo does not look up messages in the registry. It will only use the message format declared on the enum. The ->makeMessage() method is still available, though: this method will use the message registry, and will fall back on using ->message() if no message is found in the registry.

graceful fallback when intl is not loaded

A basic message formatter is included and is used if the intl extension is not available. This formatter supports named tokens (e.g., {name}), but ignores more complex formatting options like select, plural, and so forth. Given simple message formats, it should produce the same formatted message that intl's MessageFormatter would, and it does its best to reduce complex formatting expressions to a simple replacement.

This is intended more for non-icu usage (applications with simple messages) than to support a heavily localized application with many messages and complex formatting expressions. In the latter case, you should ensure the intl extension is available.

Version 2.0

2.0 requires PHP 8.3 or greater.

Additionally, peekaboo is now released under the Mozilla Public License, version 2.

Previously, the software was released under the GPLv3. That license's strong copyleft protections were a major factor in the decision to use it, but it has become apparent that their interpretations of what constitutes "combined works" was much broader than I'd understood it to be. Specifically, merely declaring this package as a dependency (e.g., via composer), without actually modifying and/or including/distributing the code with your software, was never intended to trigger these protections.

If you are using a version of this software licensed under the GPLv3, and would prefer to use it under the MPL instead, please contact me. I will grant the relicensing and waive any enforcement action against you arising from any noncompliance with the GPLv3 that would be permissible under the MPL.

tests

Run static analysis with composer test:analyze and run unit tests with composer test:unit.

Note, the first time you run a test: command, dev dependencies will be installed automatically. This requires an internet connection and may take some time.

contributing or getting help

I'm on IRC at libera#php-enspired, or open an issue on github. Feedback is welcomed as well.


All versions of peekaboo with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
php-enspired/exceptable Version 6.0
php-enspired/at_shared_exceptable Version 1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package php-enspired/peekaboo contains the following files

Loading the files please wait ....