PHPackages                             jetstreamlabs/zora - 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. jetstreamlabs/zora

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

jetstreamlabs/zora
==================

Add your Laravel language translations to your asset pipeline for use in Javascript packages like Vue or React.

v4.1.4(2y ago)164.8k5[4 PRs](https://github.com/jetstreamlabs/zora/pulls)3MITPHPPHP ^8.2

Since Jan 16Pushed 1y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (26)Used By (3)

Zora - Use your Laravel language translations in Javascript packages
====================================================================

[](#zora---use-your-laravel-language-translations-in-javascript-packages)

With Zora you can add your Laravel language translations to your asset pipeline for use in Javascript packages like Vue or React.

Zora provides two Javascript `__()` or `__trans()` translation helper functions that work like Laravel's, making it easy to use your Laravel translations in Javascript.

The package works similar to Ziggy, but without the Blade directive.

Zora supports all versions of Laravel from `8.x` onwards, and all modern browsers.

- [**Installation**](#installation)
- [**Setup**](#setup)
    - [JavaScript frameworks](#javascript-frameworks)
    - [Vue](#vue)
    - [Svelte](#svelte)
- [**Usage**](#usage)
    - [The `trans()` helper](#the-route-helper)

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

[](#installation)

Install zora into your Laravel app via composer:

```
composer require jetstreamlabs/zora --dev
```

Setup
-----

[](#setup)

#### Javascript Frameworks

[](#javascript-frameworks)

Ziggy provides an Artisan command to output its config and routes to a file: `php artisan zora:generate`. By default this command stores your translations at `resources/js/zora.js`.

The file generated by `php artisan zora:generate` will look something like this:

Alternatively, you can compile the translations to resources/js in your dev and build steps in package.json:

```
"build:assets": "php artisan zora:generate",
```

```
// zora.js

const Ziggy = {
    translations: {"en": {"php": {}, "json": {}}};
};
if (typeof window !== 'undefined' && typeof window.Zora !== 'undefined') {
  Object.assign(Zora.routes, window.Zora.routes);
}

export { Zora }
```

Create an alias to make importing Zora's core source files easier:

```
// vite.config.js
export default defineConfig({
    resolve: {
        alias: {
            // for other frameworks
            'zora-js': resolve(__dirname, 'vendor/jetstreamlabs/zora/dist/client.js'),
            // for vue
            'zora-js': resolve(__dirname, 'vendor/jetstreamlabs/zora/dist/index.js'),
            zora: resolve(__dirname, 'vendor/jetstreamlabs/zora/dist/vue.js'),
        },
    },
});
```

```
// webpack.mix.js

// Mix v6
const path = require('path');

mix.alias({
    // for other frameworks
    'zora-js': path.resolve(__dirname, 'vendor/jetstreamlabs/zora/dist/client.js'),
    // for Vue
    'zora-js': path.resolve(__dirname, 'vendor/jetstreamlabs/zora/dist/index.js'),
    zora: path.resolve(__dirname, 'vendor/jetstreamlabs/zora/dist/vue.js'),
});

// Mix v5
const path = require('path');

mix.webpackConfig({
    resolve: {
        alias: {
            // for other frameworks
            'zora-js': path.resolve(__dirname, 'vendor/jetstreamlabs/zora/dist/client.js'),
            // for Vue
            'zora-js': path.resolve(__dirname, 'vendor/jetstreamlabs/zora/dist/index.js'),
            zora: path.resolve(__dirname, 'vendor/jetstreamlabs/zora/dist/vue.js'),
        },
    },
});
```

Add the following to your app.blade.php so that translation functions will use the current locale.

```

    window.locale = '{{ app()->getLocale() }}';

```

Finally, import and use Zora like any other JavaScript library.

```
import { ZoraVue } from 'zora'
import { Zora } from '../zora.js'

// ...

__(key: string, replacers: array, config: Zora)

// or

trans(key: string, replacers: array, config: Zora)
```

#### Vue

[](#vue)

Zora includes a vue plugin to make it easy to use `trans()` or `__()` helpers throughout your app:

```
import { ZoraVue } from 'zora'
import { Zora } from '../zora.js'
```

Then use it in your app (register Zora plugin):

```
...
.use(ZoraVue, Zora)
```

#### Svelte

[](#svelte)

There is no built in integration for svelte, however to avoid passing in the Zora configuration object you can create translation helper file.

```
// i18n.svelte

    import { trans as t } from 'zora-js/'
    import { Zora } from '../zora.js'

    // window.locale = document.documentElement.lang; // optional if not set in app.blade.php

    export function __(key, replace, config=Zora){
        return t(key, replace, config);
    }
    export function trans(key, replace, config=Zora){
        return t(key, replace, config);
    }

// Dashboard.svelte

import {__} from "@/i18n.svelte";

{__("key")}
```

Usage
-----

[](#usage)

#### The `trans()` helper

[](#the-trans-helper)

Both `trans()` or `__()` helper function works like Laravel's - You can pass the key of one of your translations, and a key-pair object for replacing the placeholders as the second argument.

**Basic usage**

```
// lang/en/messages.php
return [
    'welcome' => 'Welcome to our application!',
]
```

```
// Dashbaord.js
__("messages.welcome");  // Welcome to our application!
```

**With parameters**

```
// lang/en/messages.php
return [
    'welcome' => 'Welcome, :name',
]
```

```
// Dashbaord.js
__("messages.welcome", {"name": "Zora"});  // Welcome, Zora
```

**With multiple parameters**

```
// lang/en/messages.php
return [
    'welcome' => 'Welcome, :name! There are :count apples.',
]
```

```
// Dashbaord.js
__("messages.welcome", {"name": "Zora", "count": 8});  // Welcome, Zora! There are 8 apples.
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~63 days

Total

22

Last Release

807d ago

Major Versions

v1.0.2 → v2.0.02022-01-18

v2.0.0 → v3.0.02022-01-20

v3.2.7 → v4.0.02023-05-05

PHP version history (3 changes)v3.2.0PHP ^8.0.2

v3.2.6PHP ^8.1

v4.1.3PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c31e2989d4b46bff753da02ddc5501063ccbe5c889ae6b4e4f186b1564a93b9?d=identicon)[secondmanveran](/maintainers/secondmanveran)

---

Top Contributors

[![secondmanveran](https://avatars.githubusercontent.com/u/97000801?v=4)](https://github.com/secondmanveran "secondmanveran (55 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (45 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (22 commits)")[![digvijayad](https://avatars.githubusercontent.com/u/19765483?v=4)](https://github.com/digvijayad "digvijayad (2 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

### Embed Badge

![Health badge](/badges/jetstreamlabs-zora/health.svg)

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

###  Alternatives

[mcamara/laravel-localization

Easy localization for Laravel

3.5k9.1M112](/packages/mcamara-laravel-localization)[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.3k](/packages/typicms-base)[vemcogroup/laravel-translation

Translation package for Laravel to scan for localisations and up/download to poeditor

135304.0k2](/packages/vemcogroup-laravel-translation)

PHPackages © 2026

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