Download the PHP package erag/laravel-lang-sync-inertia without Composer

On this page you can find all versions of the php package erag/laravel-lang-sync-inertia. 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 laravel-lang-sync-inertia

🌐 Laravel Easy Translation Sync with Inertia (Vue.js / React)

Screenshot
[![Packagist License](https://img.shields.io/badge/Licence-MIT-blue)](https://github.com/eramitgupta/laravel-lang-sync-inertia/blob/main/LICENSE) [![Latest Stable Version](https://img.shields.io/packagist/v/erag/laravel-lang-sync-inertia?label=Stable)](https://packagist.org/packages/erag/laravel-lang-sync-inertia) [![Total Downloads](https://img.shields.io/packagist/dt/erag/laravel-lang-sync-inertia.svg?label=Downloads)](https://packagist.org/packages/erag/laravel-lang-sync-inertia)

Laravel Lang Sync Inertia helps you add different languages to your Laravel app with Vue or React. It makes translations easy!

✨ Features


πŸ“¦ Installation

To install the package, run the following command via Composer:


πŸ› οΈ Publish Configuration & Composables

To publish the configuration and composables, run:

This will publish:

During installation, you'll be prompted to choose either Vue or React for your frontend framework.


πŸš€ Usage Guide: syncLangFiles()

The syncLangFiles() function is a Laravel helper provided by this package. Use it inside your controller methods to load translation files and automatically share them with your Vue or React frontend via Inertia.js.

βœ… Think of syncLangFiles() as a bridge between Laravel’s backend translations and your Inertia-powered frontend.


🧠 How to Use


βœ… Supported Inputs

The syncLangFiles() function supports:


πŸ§ͺ How It Works

Suppose you have the following language file:

πŸ“ resources/lang/en/auth.php

Now, you want to show auth.welcome and auth.greeting on the frontend using Vue or React.


πŸ” Step-by-Step Example

πŸ”Ή 1. Load Translations in Controller

🧠 This loads the file resources/lang/en/auth.php based on the current Laravel locale and shares its content with Inertia.


πŸ’‘ Frontend Usage

βœ… Vue Example

βœ… React Example


πŸ“€ Output on Page

When the above code is rendered, this will be the output:


🧠 Notes on trans() vs __()

Function Use Case Description
trans() Advanced Use when you need to pass dynamic placeholders like {name}
__() Simple Shortcut for quick access to translated strings

βœ… You can use them interchangeably for basic translations. βœ… Both support placeholder replacement.


πŸ›  Example with Plain String

Sometimes, you might want to append something without a key:

But recommended usage is always with an object:


πŸ“‘ Access Inertia Shared Props

Vue:

React:

You can directly access the full language object shared by Inertia.


πŸ—‚οΈ Translation File Location

Language files are loaded based on the current Laravel locale. By default, Laravel uses resources/lang/{locale} structure:

When calling:

It dynamically loads resources/lang/{locale}/auth.php.


βš™οΈ Configuration

You can customize the language directory by modifying config/inertia-lang.php:


🧩 Composables Location

You can modify the location or structure of these files by adjusting the published files.


πŸ“„ License

This package is licensed under the MIT License.


🀝 Contributing

Pull requests and issues are welcome! Let’s work together to improve localization in Laravel! πŸ’¬


All versions of laravel-lang-sync-inertia with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
laravel/pint Version ^1.13
illuminate/filesystem Version ^8.12|^9.0|^10.0|^11.0|^12.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
inertiajs/inertia-laravel Version ^1.3|^2.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 erag/laravel-lang-sync-inertia contains the following files

Loading the files please wait ....