Download the PHP package celema/verba without Composer

On this page you can find all versions of the php package celema/verba. 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 verba

Celema Verba

ci code coverage type coverage psalm level

Gettext-style internationalization for PHP without the gettext extension.

Verba keeps the workflow you know from gettext — mark strings in code, extract them, translate, ship — but drops the parts that make the extension awkward to operate:

The interchange format is plain PHP arrays, not .po/.mo, and there is no fuzzy matching: a changed message id is simply a new entry.

Verba translates messages; it does not format numbers, dates, or currency. That is localization, and PHP already has the ICU-backed tool for it — ext-intl (NumberFormatter, IntlDateFormatter, MessageFormatter), the PHP counterpart to Babel. Verba deliberately stays out of it: formatting needs CLDR data and the intl extension, which would undo its "no extension, no system locales" premise. Pair the two when you need both.

Marking strings

Eight global functions are always available:

Arguments interpolate in one of two styles. A single array argument fills named :placeholder tokens; anything else is passed to sprintf:

In __n/__np/__dn/__dnp, :count is bound to the count automatically, so __n(':count file', ':count files', $n) needs no extra argument.

A context distinguishes uses of the same message id without becoming part of the output. For example, German may translate __p('menu', 'Open') as Öffnen but __p('state', 'Open') as Offen. Context is an exact lookup axis: a miss never falls back to an uncontextual translation or another context.

With no translator active the functions return the message id itself (after interpolation), so calls are safe in tests, CLI, and early boot.

Escaping

Verba does not escape anything — it cannot, since the same catalog feeds HTML, attributes, JSON, and the terminal, and only the boundary that emits a string knows the right encoding. Two rules follow:

Runtime

A Translator is bound to one locale and an ordered cascade of domains, each mapping to the directory that holds its catalog files. The first domain with a translation wins; a miss falls back to the message id.

__d('cosray', …) and the other __d* helpers pin the cosray domain; bare helpers search the cascade. A domain selects a catalog, while a context selects a translation variant inside each catalog.

A third argument names fallback locales, tried in order whenever the primary locale lacks a string. Resolution is per id and stays within a domain before the cascade continues, so the domain cascade outranks the locale fallback:

Locale ids may contain ASCII letters, digits, hyphens, and underscores, for example zh-Hant or pt_BR. They become catalog filename segments.

This keeps a partially translated locale usable — untranslated ids surface in en instead of as raw message ids. Translator::exportMany() ships locale-specific payload entries in resolution order, each with its own plural rule; entries with no reachable messages are omitted. The JavaScript runtime therefore resolves the same chain. Fallback is a runtime concern only: extraction and i18n:status stay per catalog file, so an empty es catalog still reports as untranslated.

Catalog files

One file per domain and locale, named <domain>.<locale>.php. See the catalog format reference for the complete schema and its design rationale.

Extraction

Scanners find the calls; a Domain ties them to a catalog directory and locale set.

JavaScript runtime

The JavaScript runtime in js/ mirrors the PHP one in the browser: the same eight functions, contexts, plural rules, and named :placeholder interpolation (positional sprintf arguments stay PHP-only). Hand it the catalogs with Translator::exportMany(), inlined as JSON — list only domains meant for the browser, since the payload is readable in the page source:

The runtime is plain ES modules with JSDoc types in js/src/, so a browser loads it as it is: the Composer package carries it, and an import map can point @celema/verba at js/src/index.js. The @celema/verba npm package ships the same files plus type declarations for bundlers.

With no translator active the functions return the interpolated message id, mirroring PHP. During SSR, loadAndActivate() returns null because no DOM is available, so the global helpers use this fallback. Do not call the module-global activate() from a request handler because concurrent requests could share translators. The helper API does not currently support request-local translated SSR.

Commands

Register the two commands with your celema/console runner, passing the domains to maintain:

Mutation testing

Mutation testing with Infection is not part of composer ci, but the CI workflow runs it after the coverage step and enforces the minimum mutation score from infection.json5.dist. Pushes only mutate the changed lines; a weekly scheduled run covers the whole codebase. Run it locally with:

Reports are written to .infection/.

License

This project is licensed under the MIT license.


All versions of verba with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
celema/console Version ^0.7
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 celema/verba contains the following files

Loading the files please wait ...