PHPackages                             headwires/translator-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. headwires/translator-client

ActiveLibrary[Localization &amp; i18n](/categories/localization)

headwires/translator-client
===========================

Laravel client package for syncing translations from Headwires Translator CDN

v1.0.3(2mo ago)03MITPHPPHP ^8.2

Since Dec 12Pushed 2mo agoCompare

[ Source](https://github.com/nicolaeum/translator-client)[ Packagist](https://packagist.org/packages/headwires/translator-client)[ RSS](/packages/headwires-translator-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (14)Versions (7)Used By (0)

Translator Client for Laravel
=============================

[](#translator-client-for-laravel)

Laravel package for [LangSyncer](https://langsyncer.com) - live translation management without deployments.

Features
--------

[](#features)

- **Live Updates**: Translation changes appear in your app within seconds
- **Static Mode**: Traditional file-based translations for full control
- **Code Scanner**: Find hardcoded strings in your codebase
- **Multi-Project**: Manage multiple translation projects in one app
- **Webhooks**: Auto-sync when translations change in LangSyncer

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 10, 11, or 12

Installation
------------

[](#installation)

```
composer require headwires/translator-client
```

Publish the configuration:

```
php artisan vendor:publish --tag=translator-client-config
```

Quick Start
-----------

[](#quick-start)

Add to your `.env`:

```
CLI_TRANSLATOR_API_KEY=your-api-key-from-langsyncer
```

Sync translations:

```
php artisan translator:sync
```

Done! Use Laravel's translation helpers as usual:

```
{{ __('messages.welcome') }}
{{ __('messages.greeting', ['name' => $user->name]) }}
```

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

VariableDescriptionDefault`CLI_TRANSLATOR_API_KEY`Your project API key from LangSyncerrequired`CLI_TRANSLATOR_CLIENT_MODE``static`, `live`, or `auto``static``CLI_TRANSLATOR_SYNC_STRATEGY``overwrite` or `merge``overwrite``CLI_TRANSLATOR_CLIENT_CACHE_TTL`Cache TTL in seconds (live mode)`3600``CLI_TRANSLATOR_CLIENT_WEBHOOK_ENABLED`Enable webhook endpoint`true`### Client Modes

[](#client-modes)

#### Static Mode (Default)

[](#static-mode-default)

Translations saved as PHP files in `resources/lang/`. Best for production.

```
CLI_TRANSLATOR_CLIENT_MODE=static
```

#### Live Mode

[](#live-mode)

Translations loaded from cache, updated instantly via webhooks. Uses your project's configured cache driver.

```
CLI_TRANSLATOR_CLIENT_MODE=live
```

#### Auto Mode

[](#auto-mode)

Automatically selects live mode for serverless (Vapor) or static mode otherwise.

```
CLI_TRANSLATOR_CLIENT_MODE=auto
```

### Sync Strategies

[](#sync-strategies)

#### Overwrite (Default)

[](#overwrite-default)

Replaces local files completely. Use when LangSyncer is your source of truth.

```
CLI_TRANSLATOR_SYNC_STRATEGY=overwrite
```

#### Merge

[](#merge)

Preserves local-only keys while updating from LangSyncer. CDN values take precedence for existing keys.

```
CLI_TRANSLATOR_SYNC_STRATEGY=merge
```

Commands
--------

[](#commands)

### translator:sync

[](#translatorsync)

Download translations from LangSyncer:

```
php artisan translator:sync

# Sync specific project (if using multi-project)
php artisan translator:sync --project=main

# Force sync (ignore checksums)
php artisan translator:sync --force
```

### translator:warmup

[](#translatorwarmup)

Pre-cache translations for live mode. Run during deployment:

```
php artisan translator:warmup
```

### translator:status

[](#translatorstatus)

Check configuration and connection status:

```
php artisan translator:status
```

Output:

```
Project Name
   API Key: 019bd1c2-... (configured)
   Path: /var/www/app/resources/lang
   Mode: live
   Cache TTL: 3600s
   Webhook: configured

```

### translator:scan

[](#translatorscan)

Scan your codebase for hardcoded strings:

```
php artisan translator:scan
```

Scans `.blade.php` and `.php` files for text that should be translated.

### translator:apply

[](#translatorapply)

Apply approved scanner suggestions and activate translations:

```
php artisan translator:apply
```

Multi-Project Setup
-------------------

[](#multi-project-setup)

Configure multiple projects in `config/translator-client.php`:

```
'projects' => [
    [
        'name' => 'main',
        'api_key' => env('CLI_TRANSLATOR_API_KEY'),
        'path' => resource_path('lang'),
        'scan_paths' => ['resources/views', 'app'],
    ],
    [
        'name' => 'package',
        'api_key' => env('CLI_TRANSLATOR_PACKAGE_API_KEY'),
        'path' => base_path('vendor/your-package/resources/lang'),
        'scan_paths' => ['vendor/your-package/resources/views'],
    ],
],
```

Sync specific project:

```
php artisan translator:sync --project=package
```

Webhooks
--------

[](#webhooks)

The package automatically registers a webhook endpoint at `/api/translator/webhook`. Configure this URL in your LangSyncer project settings.

When translations are published in LangSyncer, the webhook triggers an automatic sync.

Customize the route:

```
CLI_TRANSLATOR_CLIENT_WEBHOOK_ROUTE=/custom/webhook/path
```

Disable webhooks:

```
CLI_TRANSLATOR_CLIENT_WEBHOOK_ENABLED=false
```

Deployment
----------

[](#deployment)

Add to your deployment script:

```
php artisan translator:sync
php artisan translator:warmup  # if using live mode
```

### Laravel Scheduler

[](#laravel-scheduler)

Auto-sync translations:

```
// app/Console/Kernel.php
protected function schedule(Schedule $schedule)
{
    $schedule->command('translator:sync')
        ->hourly()
        ->withoutOverlapping();
}
```

File Structure
--------------

[](#file-structure)

After syncing (static mode):

```
resources/lang/
├── en/
│   ├── messages.php      # Managed by LangSyncer
│   ├── auth.php          # Managed by LangSyncer
│   └── custom.php        # Your local translations (safe)
└── es/
    ├── messages.php
    ├── auth.php
    └── custom.php

```

> **Note**: Synced files include a warning header. Create separate files for local-only translations.

License
-------

[](#license)

MIT

Support
-------

[](#support)

- Documentation: [langsyncer.com/documentation](https://langsyncer.com/documentation)
- Issues: [GitHub Issues](https://github.com/headwires/translator-client/issues)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance83

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~23 days

Total

4

Last Release

87d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0738c16b0fd0e450aab12cd4fc72358b4ec6b2588c06117aa344ac793f018f34?d=identicon)[nicolaeum](/maintainers/nicolaeum)

---

Top Contributors

[![nicolaeum](https://avatars.githubusercontent.com/u/277078?v=4)](https://github.com/nicolaeum "nicolaeum (20 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/headwires-translator-client/health.svg)

```
[![Health](https://phpackages.com/badges/headwires-translator-client/health.svg)](https://phpackages.com/packages/headwires-translator-client)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[torchlight/torchlight-laravel

A Laravel Client for Torchlight, the syntax highlighting API.

120452.8k11](/packages/torchlight-torchlight-laravel)[glhd/conveyor-belt

14797.0k](/packages/glhd-conveyor-belt)[kerigard/laravel-lang-ru

Ru lang for Laravel

2116.8k](/packages/kerigard-laravel-lang-ru)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
