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

Abandoned → [zenphp/zorah](/?search=zenphp%2Fzorah)Library[Localization &amp; i18n](/categories/localization)

zenphp/zora
===========

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

v2.1.3(3mo ago)019MITPHPPHP ^8.4CI passing

Since Sep 26Pushed 3mo agoCompare

[ Source](https://github.com/zenphporg/zorah)[ Packagist](https://packagist.org/packages/zenphp/zora)[ RSS](/packages/zenphp-zora/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (17)Used By (0)

[![Zen Foundation](https://raw.githubusercontent.com/zenphporg/.github/main/img/zenphp.png)](https://raw.githubusercontent.com/zenphporg/.github/main/img/zenphp.png)

 [![Build Status](https://camo.githubusercontent.com/65d6e06d3a3f1779b42c2b24dfcddf1b13a2752a7173ad5071e2ca091a7a5d58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a656e7068706f72672f7a6f7261682f6d61696e2e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473)](https://github.com/zenphporg/zorah/actions) [![Coverage](https://camo.githubusercontent.com/a5d4d68c05fa516ea5a826fd7815e2871d52611073932654c79968655a304e88/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64796e616d69632f786d6c3f636f6c6f723d73756363657373266c6162656c3d636f7665726167652671756572793d726f756e64253238253246253246636f76657261676525324670726f6a6563742532466d657472696373253246253430636f7665726564656c656d656e7473253230646976253230253246253246636f76657261676525324670726f6a6563742532466d657472696373253246253430656c656d656e7473253230253241253230313030253239267375666669783d2532352675726c3d68747470732533412532462532467261772e67697468756275736572636f6e74656e742e636f6d2532467a656e7068706f72672532467a6f7261682532466d61696e253246636c6f7665722e786d6c)](https://github.com/zenphporg/zorah/blob/main/clover.xml) [![Total Downloads](https://camo.githubusercontent.com/ee1d5a32d8b758dbb4ee7d9564a44757a5117d7a1ac4c1a6328417c3b00e621a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a656e7068702f7a6f726168)](https://packagist.org/packages/zenphp/zorah) [![Latest Stable Version](https://camo.githubusercontent.com/29fdc6ea41ba0b84627e27ec899ba3aede9b8d057d19d7d829a3676dbaab185a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a656e7068702f7a6f726168)](https://packagist.org/packages/zenphp/zorah) [![License](https://camo.githubusercontent.com/7dfa65058a6f069d684bf2a492903e68d6f9a68f975211b31ca7e17fd39232f5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a656e7068702f7a6f726168)](https://packagist.org/packages/zenphp/zorah)

About Zorah
-----------

[](#about-zorah)

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

Zorah provides two `__()` and `trans()` translation helper functions that work like Laravel's, making it easy to use your Laravel translations in JavaScript. Written in TypeScript with full type definitions included.

The package works similar to [Ziggy](https://github.com/tightenco/ziggy) for routing, but **without** the Blade directive.

Zorah supports all versions of Laravel from `11.x` onwards, and all modern browsers.

- [About Zorah](#about-zorah)
- [Installation](#installation)
- [Setup](#setup)
    - [JavaScript Frameworks](#javascript-frameworks)
    - [Vue](#vue)
    - [SSR with Vite](#ssr-with-vite)
    - [TypeScript with Inertia](#typescript-with-inertia)
    - [Svelte](#svelte)
- [Usage](#usage)

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

[](#installation)

Install Zorah into your Laravel app via composer:

```
composer require zenphp/zorah
```

### Vue Version Compatibility

[](#vue-version-compatibility)

Vue VersionZorah VersionInstall Command3.5+2.x (latest)`composer require zenphp/zorah`3.0 - 3.41.0.7`composer require zenphp/zorah:1.0.7`> **Note:** As of v2.1, the CommonJS build is now `dist/index.cjs`. ESM users (Vite, etc.) are unaffected.

Setup
-----

[](#setup)

#### JavaScript Frameworks

[](#javascript-frameworks)

Zorah provides an Artisan command to output its config and translations to a file: `php artisan zorah:generate`. By default this command generates a TypeScript file at `resources/js/zorah.ts`.

```
# Generate TypeScript (default)
php artisan zorah:generate

# Generate JavaScript instead
php artisan zorah:generate --js

# Custom path
php artisan zorah:generate ./resources/js/translations.ts
```

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

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

The generated TypeScript file will look something like this:

```
// zorah.ts
import type { ZorahConfig } from 'zorah-js'

const Zorah: ZorahConfig = {
  translations: {"en": {"php": {}, "json": {}}}
};

if (typeof window !== 'undefined' && typeof window.Zorah !== 'undefined') {
  Object.assign(Zorah.translations, window.Zorah.translations);
}

export { Zorah }
```

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

```
// vite.config.js
export default defineConfig({
  resolve: {
    alias: {
      'zorah-js': resolve(__dirname, 'vendor/zenphp/zorah/dist/index.js'),
    },
  },
});
```

```
// webpack.mix.js

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

mix.alias({
  'zorah-js': path.resolve(__dirname, 'vendor/zenphp/zorah/dist/index.js'),
});

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

mix.webpackConfig({
  resolve: {
    alias: {
      'zorah-js': path.resolve(__dirname, 'vendor/zenphp/zorah/dist/index.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 Zorah like any other JavaScript library.

```
import { trans, type ZorahConfig } from 'zorah-js'
import { Zorah } from './zorah'

// Use the trans function directly
trans(key: string, replace?: Record, config?: ZorahConfig): string

// Or use the __ alias (available when using the Vue plugin)
__(key: string, replace?: Record, config?: ZorahConfig): string
```

#### Vue

[](#vue)

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

```
import { ZorahVue } from 'zorah-js'
import { Zorah } from './zorah'
```

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

```
createApp(App)
  .use(ZorahVue, Zorah)
  .mount('#app')
```

#### SSR with Vite

[](#ssr-with-vite)

When using Server-Side Rendering with Vite, you'll need to set the `VITE_LOCALE` environment variable since `window.locale` is not available on the server.

Add this to your `.env` file:

```
VITE_LOCALE="${APP_LOCALE}"
```

Or set it dynamically in your SSR entry point before rendering:

```
import.meta.env.VITE_LOCALE = locale;
```

For webpack/Node.js environments, use `process.env.LOCALE` instead. Zorah automatically detects which environment you're in and uses the appropriate method.

#### TypeScript with Inertia

[](#typescript-with-inertia)

If you're using TypeScript with Laravel Inertia, add the `__` and `trans` methods to your `globals.d.ts` file for proper type support in Vue components:

```
// resources/js/globals.d.ts

+import type { ZorahConfig, ReplacementValues } from 'zorah-js'

declare module 'vue' {
  interface ComponentCustomProperties {
    $inertia: typeof Router;
    $page: Page;
    $headManager: ReturnType;
+   __: (key: string, replace?: ReplacementValues, config?: ZorahConfig) => string;
+   trans: (key: string, replace?: ReplacementValues, config?: ZorahConfig) => string;
  }
}
```

This enables full type checking for `__()` and `trans()` in your Vue components.

#### Svelte

[](#svelte)

There is no built-in integration for Svelte, however to avoid passing in the Zorah configuration object you can create a translation helper file.

```
// i18n.svelte

  import { trans as t, type ZorahConfig, type ReplacementValues } from 'zorah-js'
  import { Zorah } from '../zorah'

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

  export function __(key: string, replace?: ReplacementValues, config: ZorahConfig = Zorah) {
    return t(key, replace, config);
  }

  export function trans(key: string, replace?: ReplacementValues, config: ZorahConfig = Zorah) {
    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: 'Zorah' }); // Welcome, Zorah
```

**With multiple parameters**

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

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

Maintenance Branches
--------------------

[](#maintenance-branches)

Zorah follows semantic versioning using maintenance branches:

- `main` - Latest development version
- `N.x` - Maintenance branches for major versions (e.g., `1.x`, `2.x`)

---

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](https://github.com/zenphporg/zorah/security/policy) on how to report security vulnerabilities.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance86

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 66.1% 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 ~32 days

Recently: every ~13 days

Total

16

Last Release

104d ago

Major Versions

v1.0.7 → v2.0.02025-12-03

PHP version history (2 changes)v1.0.0PHP ^8.3

v2.1.2PHP ^8.4

### 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 (37 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (14 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

###  Code Quality

TestsPest

Static AnalysisRector

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M680](/packages/barryvdh-laravel-ide-helper)[mariuzzo/laravel-js-localization

Laravel Localization in JavaScript

6073.9M3](/packages/mariuzzo-laravel-js-localization)[illuminate/translation

The Illuminate Translation package.

6936.4M490](/packages/illuminate-translation)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M157](/packages/orchestra-canvas)[nikaia/translation-sheet

Laravel Translation via Google Spreadsheet

294606.4k1](/packages/nikaia-translation-sheet)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)

PHPackages © 2026

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