Download the PHP package bretterer/laravel-pseudoloc without Composer

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

Laravel Pseudoloc

Latest Version on Packagist Tests Code Style Total Downloads

Flip a flag, see every i18n bug. Turn pseudolocalization on and every translated string in your Laravel app renders accented and expanded at runtime — while anything hardcoded in Blade stays plain English and screams "I'm not translated."

No generated files. It just works. You do not create a pseudo locale, run a generator, or add a lang/ file to translate, commit, and later delete. There is nothing to build and nothing to clean up. Set one env var (PSEUDOLOC_ENABLED=true) — or flip a cookie on staging — and the package decorates Laravel's translator binding so every string transforms as it is resolved. Turn the flag off and you are exactly where you started. That is the whole install.

Why

Every peer ecosystem ships runtime pseudolocalization — Symfony has it in core, Rails has Shopify's gem, i18next has a plugin, iOS and Android have OS-level support. Laravel had nothing. This fills that gap, and the side effect is the killer feature:

Requirements

Installation

The package auto-registers its service provider. Turn it on in your local or staging environment only:

That's it. It is a hard no-op in production regardless of configuration, and is force-disabled during tests so it can never corrupt your assertions.

Optionally publish the config file:

Configuration

Option Env Default Description
enabled PSEUDOLOC_ENABLED false Master switch. Hard no-op in production regardless.
expansion_factor PSEUDOLOC_EXPANSION_FACTOR 1.35 Grow strings to ~this multiple of their length. 1.0 disables expansion.
markers ['[!! ', ' !!]'] [prefix, suffix] wrapped around each string. [] disables.
accents null Override the character → accented-character map. null uses the built-in Latin map.
allow_request_toggle PSEUDOLOC_ALLOW_REQUEST_TOGGLE true Allow the per-request cookie toggle (see below).
enable_in_tests false Let pseudolocalization run under runningUnitTests(). Leave off unless testing the tool itself.

Per-request toggle (the two-tab demo)

Instead of redeploying to flip the flag, you can toggle pseudolocalization per browser with a query string — perfect for A/B'ing a normal tab against a pseudolocalized one on a shared staging URL.

Register the middleware manually in bootstrap/app.php, after EncryptCookies (it reads a cookie), which the default web group ordering already guarantees:

Then:

The choice is stored in a cookie (not the query string) so it survives query-less Livewire/AJAX requests, and the toggling request itself already renders in the new state.

Effective state

Production is always off. Otherwise, with enabled = PSEUDOLOC_ENABLED:

enabled allow_request_toggle cookie Result
any false any = enabled (cookie ignored)
any true absent = enabled
any true 1 on
any true 0 off

The cookie overrides enabled in both directions, which is what lets one tab be pseudolocalized while another is normal.

What it covers

Because the transform hooks the translator's makeReplacements(), it covers everything that flows through Laravel translation in one place:

It is careful about three things that a naive implementation gets wrong, each covered by tests:

  1. Validation isn't broken. Laravel detects custom messages via trans($key) === $key. Unresolved dotted keys are returned byte-identical, so custom-message detection and default messages keep working.
  2. Plurals aren't broken. The raw {0}...|[1,*]... string reaches the message selector untransformed; only the chosen segment is pseudolocalized, exactly once.
  3. Lang::has() isn't broken. Existence checks never report a missing key as present.

Limitations (by design, in v1)

Testing

Credits

License

The MIT License (MIT). See LICENSE.md.


All versions of laravel-pseudoloc with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^12.0 || ^13.0
illuminate/cookie Version ^12.0 || ^13.0
illuminate/http Version ^12.0 || ^13.0
illuminate/routing Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0
illuminate/translation Version ^12.0 || ^13.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 bretterer/laravel-pseudoloc contains the following files

Loading the files please wait ...