Download the PHP package smartness/translation-client without Composer

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

Smartness Translation Client

Latest Version on Packagist Total Downloads

A Laravel package to synchronize translations between your Laravel application and a centralized translation management system. Pull translations from the server or push local translations back to keep everything in sync.

Features

Requirements

Installation

Install via Composer:

The package will automatically register itself via Laravel's package auto-discovery.

Configuration

Step 1: Publish Configuration (Optional)

This creates a config/translation-client.php file where you can customize settings.

Step 2: Configure Environment Variables

Add these variables to your .env file:

Note: You'll receive your API token and endpoint URL from your translation service administrator.

Usage

Pulling Translations (Download)

Pull all translations from the server:

Pull translations for a specific language:

Preview changes without saving (dry-run):

Test API connection:

Advanced Pull Options

Pushing Translations (Upload)

Push all local translations to the server:

Push translations for a specific language:

Push a specific translation file:

Preview without actually pushing:

Overwrite existing translations on the server:

Use a custom translation directory:

Advanced Push Options

Reconciling the Catalog with Source Code

These two commands scan your local source for $t('…'), useTranslate('…'), i18n.t('…'), trans('…'), __('…') and @lang('…') calls and reconcile what they find with what the server stores.

Both commands first fetch the project's central scan configuration from GET /translation-projects/config. Local config (config/translation-client.php or SMARTPMS_TRANSLATION_* env vars) always wins; the server values are a shared default; package defaults are used if neither is set. The resolved config is printed at the start of each run so you can verify which source provided each value.

translations:missing — Find Keys Used in Code but Absent Remotely

Sample output:

translations:cleanup — Find Keys Stored Remotely but Unused in Code

Dynamic keys built with template literals (e.g. $t(`amenities.${name}`)) contribute a static prefix that protects every matching remote key from deletion — no false positives when the key set is computed at runtime.

Output Structure

The package creates translation files following Laravel's standard structure:

Example Generated File

Programmatic Usage

You can use the Translation Client directly in your code:

Available Methods

Method Description Returns
fetchAsPhp(?string $language) Fetch translations as nested PHP arrays (Laravel format) array
fetchAsJson(?string $language) Fetch translations as flat JSON structure array
fetchRaw(?string $language) Fetch raw format with full metadata array
fetch(array $options) Fetch with custom options array
push(array $translations, array $options) Push translations to the server array
pushLanguage(string $language, array $translations, bool $overwrite) Push translations for a specific language array
pushFile(string $language, string $filename, array $translations, bool $overwrite) Push a specific translation file array
fetchProjectConfig() Fetch the centralized scan config from the server. Returns null on failure so callers can fall back to local config. ?array
cleanup(array $usedKeys, array $usedPrefixes, bool $delete) Report (and optionally delete) remote keys not referenced in source. array
discoverMissing(array $usedKeys, array $usedPrefixes, bool $insert) Report (and optionally insert) keys referenced in source but missing remotely. array
testConnection() Verify API connection and token bool

CI/CD Integration

GitHub Actions

Add this workflow to automatically sync translations:

GitLab CI

Configuration Reference

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

Error Handling

The package provides clear, actionable error messages:

Troubleshooting

"API token not configured"

Solution: Add your API token to .env:

"Authentication failed"

Solution: Verify your API token is correct. Contact your translation service administrator if needed.

"Connection timeout"

Solutions:

Translations not updating

Solutions:

Advanced Usage

Custom Fetch Options

Custom Output Directory

Multiple Environments

Security

Important: Never commit your API token to version control. Always use environment variables.

Support

For issues, questions, or feature requests:

License

The MIT License (MIT). Please see License File for more information.

Credits


All versions of translation-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.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 smartness/translation-client contains the following files

Loading the files please wait ...