Download the PHP package a21/lexicon-client without Composer

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

a21/lexicon-client

Laravel package to connect any client application to a central Lexicon translation server.

Lexicon is a SaaS-style translation source of truth. This package lets an app:

Requirements

Installation

The service provider is auto-discovered via Laravel package discovery (extra.laravel.providers), so no manual registration is needed. If you disable auto-discovery, register it manually in config/app.php (or bootstrap/providers.php on Laravel 11+):

Publish the config file and scaffold the manifest:

For Gallery / UGC Google MT sync (consumer table + webhook):

See docs/ugc-entity-translations-sync.md.

Configuration

config/lexicon.php (published) reads everything from the environment:

Key Purpose
api_url Base URL of the Lexicon server (the client calls {api_url}/api/lexicon).
client_code Integration client identifier (falls back to lexicon.json → client).
project_code Target project (falls back to lexicon.json → project).
secret Integration client secret — server-side only.
environment Logical environment sent to Lexicon (local/develop/production).
manifest Absolute path to lexicon.json (defaults to the project root).
output.* How pulled translations are written back to lang/.
http.* Timeouts and retry policy for outbound requests.

Environment variables

Add to .env (never commit secrets):

Get LEXICON_CLIENT_SECRET by creating an integration client on the Lexicon server (admin API); the secret is shown once.

LEXICON_SYNC_SECRET must match integration_clients.sync_secret on Lexicon, and Lexicon sync_url must point to https://your-api/api/localization/sync.

UGC sync (entity_translations)

Dual-store model:

Store Role
Lexicon DB Edit / Google MT / approve
This app DB Synced copy for Gallery (approved-only)

This publishes the entity_translations migration, registers POST /api/localization/sync when LEXICON_UGC_SYNC_ENABLED=true, and documents the two secrets (inbound client secret vs outbound sync secret).

Full guide: docs/ugc-entity-translations-sync.md.

The lexicon.json manifest

A non-secret file at the project root, versioned with your app. It is merged with config/lexicon.php at runtime (config wins for credentials; the manifest provides client/project fallbacks plus languages, areas, output, import and extractors).

Never put LEXICON_CLIENT_SECRET in lexicon.json.

Authentication & HTTP

All requests go to {api_url}/api/lexicon/... with these headers (built by LexiconHttpClient):

Header Value
Authorization Bearer <secret>
X-Lexicon-Client client_code
X-Lexicon-Project project_code
X-Lexicon-Environment environment
Accept application/json

Requests use the configured timeout, and automatically retry retry_times on 5x server errors. Endpoints used: /client/status, /client/export, /client/import, /integrations/translate.

Artisan commands

Command Description
php artisan lexicon:init Create lexicon.json and append keys to .env.example.
php artisan lexicon:install-ugc-sync Publish entity_translations migration + enable Lexicon→app sync webhook.
php artisan lexicon:status Check server connection and project metadata.
php artisan lexicon:export Request an export bundle from the server.
php artisan lexicon:import Scan local lang/ files and import into Lexicon.
php artisan lexicon:pull Write only files whose Lexicon content hash changed.
php artisan lexicon:extract Preview translatable content from configured extractors (read-only).
php artisan lexicon:push Extract and push translatable content to Lexicon.
php artisan lexicon:sync Extract configured sources and synchronise them with Lexicon.
php artisan lexicon:scan-usage Scan exact translation key literals in client code and report Used/Unused to Lexicon.

Key usage scan (exact literals only)

V1 marks a catalog key Used only when an exact string literal appears in code (__('age_artist'), @lang('…'), t('…'), …). Dynamic concatenations like __('artist.'.$id) are ignored and stay Unused unless the same literal is found elsewhere.

Options: --application, --path=*, --lang=*, --dry-run, --no-replace-unmentioned.

Import / pull (interface layer)

Prefer lexicon:pull without --force. PHP output defaults to merge=add_missing: only new non-empty leaf keys under existing top-level branches are injected. Use --replace (or output.merge=replace) to overwrite full trees from Lexicon. Use --force only to rewrite even when the Lexicon content is unchanged.

Extract / push / sync (all layers)

Shared options: --group=<name> (repeatable), --entity=<type> (repeatable), --all, --dry-run.

The push summary reports created vs already existing entries and any failures. Pushing never deletes server-side keys or translations.

Translation layers

Every pushed entry carries a layer describing how it is sourced and keyed:

Layer Typical source Key strategy
interface lang/*.php, lang/*.json nested dotted key path
template Blade views / email templates {template_path}_{segment}
database DB rows owned by the app {code\|slug\|id}_{field}
content CMS-style entities {entity_type}_{entity_id}_{field}

Google MT: Lexicon generates and accepts Google MT suggestions for all layers (content, interface, template, database). The Lexicon UI review workflow labels (draft / needs_review) are emphasized for content projects; UGC / Gallery entity sync (needs_review=true) remains the consumer path for CMS-style content.

Extractors

Declare an extractors array in lexicon.json. Each item is matched to an extractor by type. group and entity_type power the --group/--entity filters. Relative base_path / paths are resolved against the app root.

Type Reads Key definition fields
files lang/ for the source locale (flattened) base_path, source_language, formats
blade .blade.php — __(), trans(), @lang() (deduped) paths[], area
database / content rows from a DB table via Illuminate\Support\Facades\DB connection, table, id_column, code_column, fields[], where{}, source_url

The database/content extractors use your configured Laravel database connections. connection: null uses the default connection; set it to any name from config/database.php. where maps column => value (a null value becomes WHERE column IS NULL). source_url supports {id} and {code} placeholders so translators can jump back to the source screen.

See docs/extraction-and-layers.md for the full reference and a custom-extractor guide.

Scheduling

Run extraction on a schedule (e.g. keep DB content in sync nightly). In app/Console/Kernel.php (Laravel 10) or routes/console.php (Laravel 11+):

Programmatic usage

Call the extraction engine or HTTP client directly from your own services:

A custom extractor only implements A21\LexiconClient\Extraction\Extractor (type() + extract(array $definition): array returning ExtractedEntry[]).

Server setup

Create an integration client on the Lexicon server (admin API), copy the secret once, then configure this package. See the Lexicon server docs: docs/client-package.md, docs/client-package-js.md (npm), docs/integration-api.md, docs/export-cli.md.

Security

Troubleshooting

License

MIT


All versions of lexicon-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.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 a21/lexicon-client contains the following files

Loading the files please wait ...