PHPackages                             loklify/laravel - 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. loklify/laravel

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

loklify/laravel
===============

Laravel package for Loklify translations

1.0.0(1mo ago)025MITPHPPHP &gt;=8.2

Since Apr 15Pushed 1mo agoCompare

[ Source](https://github.com/Loklify/laravel)[ Packagist](https://packagist.org/packages/loklify/laravel)[ RSS](/packages/loklify-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

Loklify for Laravel
===================

[](#loklify-for-laravel)

[![Latest Version](https://camo.githubusercontent.com/ca68b695ce4fab0ece0c4b10ec9338e5a316b94ce37dbc56fba5f9a6f4350949/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f6b6c6966792f6c61726176656c2e737667)](https://packagist.org/packages/loklify/laravel)[![License](https://camo.githubusercontent.com/67650bb583b147711e0e80822313746fda657d27057b90140b4ab905d9a25155/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6f6b6c6966792f6c61726176656c2e737667)](https://packagist.org/packages/loklify/laravel)

The official Laravel package for [Loklify](https://loklify.com) — the simple i18n platform for small teams.

Loklify replaces your local JSON translation files with a hosted API. Update translations on [loklify.com](https://loklify.com) and your Laravel app picks them up at runtime — no rebuild, no redeploy.

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

[](#requirements)

- PHP 8.2+
- Laravel 11, 12 or 13

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

[](#installation)

```
composer require loklify/laravel
```

Publish the config file:

```
php artisan vendor:publish --tag=loklify-config
```

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

[](#configuration)

Add these variables to your `.env` file:

```
LOKLIFY_PROJECT_ID=your-project-uuid
LOKLIFY_CACHE_TTL=3600
```

VariableDescriptionDefault`LOKLIFY_PROJECT_ID`Your project UUID (found in your [Loklify](https://loklify.com) dashboard)—`LOKLIFY_CACHE_TTL`Cache duration in seconds. Set to `0` to disable caching.`3600`> The translation endpoint is **public** — no API token is required.

### Config file

[](#config-file)

After publishing, the config is available at `config/loklify.php`:

```
return [
    'url'        => env('LOKLIFY_URL', 'https://api.loklify.com'),
    'project_id' => env('LOKLIFY_PROJECT_ID'),
    'token'      => env('LOKLIFY_TOKEN'),
    'cache_ttl'  => env('LOKLIFY_CACHE_TTL', 3600),
];
```

Usage
-----

[](#usage)

Once installed, Laravel's built-in translation system (`__()`, `@lang`, `trans()`) works with Loklify out of the box.

```
// In a controller
return view('welcome', [
    'greeting' => __('home.welcome'),
]);
```

```
{{-- In Blade --}}
{{ __('home.welcome') }}
@lang('home.subtitle')
```

Translations are fetched from your [Loklify](https://loklify.com) project and cached locally for the configured TTL.

### How it works

[](#how-it-works)

The package registers a custom `LoklifyLoader` that wraps Laravel's default file-based translation loader:

1. **JSON translations** (group `*`, namespace `*`) are loaded from the Loklify API
2. **All other translations** (PHP files, vendor namespaces) fall through to the default Laravel loader
3. **ETag support** — the loader sends `If-None-Match` headers. When translations haven't changed, the API returns `304 Not Modified` and the local cache is reused without downloading data
4. **Caching** — translations are cached locally. A freshness key prevents hitting the API on every request. After the TTL expires, the next request revalidates with the server

### Cache flow

[](#cache-flow)

```
Request → Is fresh? (TTL not expired)
  ├── Yes → Return cached translations (no HTTP call)
  └── No → Send request with ETag
        ├── 304 Not Modified → Refresh TTL, return cached
        └── 200 OK → Store new translations + ETag, refresh TTL

```

Managing translations
---------------------

[](#managing-translations)

Create and manage your translations on [loklify.com](https://loklify.com):

1. Create a project and add your languages
2. Add translation keys (e.g. `home.welcome`, `auth.login`)
3. Fill in translations — changes are live instantly
4. Your Laravel app fetches them at runtime

Clearing the cache
------------------

[](#clearing-the-cache)

To force-refresh translations:

```
php artisan cache:forget loklify.fresh.fr
php artisan cache:forget loklify.fresh.en
```

Or clear all cache:

```
php artisan cache:clear
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT. See [LICENSE](LICENSE) for details.

Links
-----

[](#links)

- [Loklify Platform](https://loklify.com)
- [Documentation](https://loklify.com)
- [GitHub](https://github.com/loklify/laravel)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance90

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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 ~9 days

Total

2

Last Release

45d ago

Major Versions

0.0.1 → 1.0.02026-04-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/d63215c651dd6a371cc8fd3f050c68bdebdad0ff4b1c920557a49fccb0f322f6?d=identicon)[Airbound](/maintainers/Airbound)

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/loklify-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/loklify-laravel/health.svg)](https://phpackages.com/packages/loklify-laravel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)[illuminate/translation

The Illuminate Translation package.

6937.4M554](/packages/illuminate-translation)[moonshine/moonshine

Laravel administration panel

1.3k239.9k72](/packages/moonshine-moonshine)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

719160.4k12](/packages/tallstackui-tallstackui)[illuminate/pipeline

The Illuminate Pipeline package.

9348.3M264](/packages/illuminate-pipeline)

PHPackages © 2026

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