Download the PHP package our-edu/laravel-translation-client without Composer

On this page you can find all versions of the php package our-edu/laravel-translation-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 laravel-translation-client

Laravel Translation Client

Latest Version

A Laravel package for consuming centralized translation services. This package replaces Laravel's file-based translation loader with an API-based loader that fetches translations from a remote translation service.

Features

Requirements

Installation

1. Install via Composer

2. Publish Configuration

This will create config/translation-client.php.

3. Configure Environment

Add the following to your .env file:

4. Configure Available Locales

In config/translation-client.php, add:

Configuration

All configuration options are in config/translation-client.php:

Usage

Basic Usage

Once installed, use Laravel's translation functions as normal:

Commands

Clear Cache

Clear translation caches:

Import Translations

Import translations from Laravel lang files to the service:

Keeping Translations Fresh

Nothing needs scheduling. Translations are fetched on first use and cached, and each cached bundle carries the version it was built from. That version is checked against the service's manifest on every read, so a bundle cannot go stale indefinitely.

There is a lag, though, and it is worth knowing. The manifest is itself cached for manifest_ttl — 300 seconds by default. Until that entry expires the version comparison is against a stale manifest, so it agrees with the cached bundle and serves it. An edit in the service therefore appears within manifest_ttl, not on the very next request.

Measured against a real consuming app: a value created in the service was still absent immediately afterwards, and present once the manifest cache was cleared.

Lower TRANSLATION_MANIFEST_TTL if you need edits to land faster — it costs one small request per locale per interval — or run translations:clear-cache to force it immediately.

Middleware for Locale Detection

Add to app/Http/Kernel.php:

This middleware detects locale from:

  1. Query parameter (?locale=ar)
  2. Header (X-Locale: ar)
  3. Accept-Language header
  4. Authenticated user preference

Using the Facade

Reading Translations

Writing Translations

Programmatic Access

How It Works

Architecture

Caching Strategy

  1. Memory Cache: Loaded translations stored in PHP memory
  2. Laravel Cache: Persistent cache with configurable TTL
  3. Version Checking: Manifest API checked every 5 minutes
  4. Automatic Invalidation: Cache refreshed when version changes

Performance

Multi-Tenant Support

For multi-tenant applications:

Error Handling

The package handles errors gracefully:

Enable logging for debugging:

Testing

When testing, you may want to disable API calls:

Troubleshooting

Translations not loading

  1. Check service URL is correct: php artisan config:cache
  2. Verify API is accessible: curl https://your-service.com/translation/manifest?locale=en
  3. Enable logging: TRANSLATION_LOGGING=true
  4. Check logs: tail -f storage/logs/laravel.log

Cache not clearing

Performance issues

  1. Use Redis for caching instead of file cache
  2. Increase cache TTL if translations rarely change

License

This package is open-sourced software licensed under the MIT license.

Support

For issues and questions, please use the GitHub issue tracker.


All versions of laravel-translation-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3|^8.4
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/translation Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/cache 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 our-edu/laravel-translation-client contains the following files

Loading the files please wait ...