Download the PHP package empuxa/laravel-locale-via-api without Composer

On this page you can find all versions of the php package empuxa/laravel-locale-via-api. 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-locale-via-api

Laravel Locale Via API

Latest Version on Packagist Tests Total Downloads

Banner

This package lets you share your local translations via API, so that any app can use them. To do so, it converts your PHP lang files to JSON.

Requirements

  1. You must provide your lang files within folders, such as lang/en or lang/de.
  2. The lang files must be in PHP format, such as `lang/en/validation.php.
  3. Must secure the API routes and its patterns on your own.

Installation

This package requires Laravel 9.33+. You can install the package via composer:

Afterward, you might want to copy the vendor files:

Remember to also update the config file config/locale-via-api.php to your needs!

Usage

This package provides two controllers to access your translations via API. You must add them to your routes/api.php file manually.

Empuxa\LocaleViaApi\Http\Controllers\ListLocalesController

With this controller, you can list any locale that is available in your app. For security reasons, it only returns the array from your config and doesn't read the actual files.

By adding ?flatten=true to the URL, you can get a flat array of all available locales. You can also change the default behavior in the config file.

Non-flattened response

Flattened response

Empuxa\LocaleViaApi\Http\Controllers\GetLocaleController

This controller returns the contents of a locale directory as JSON. If the directory does not exist, it will return an error 404.

Security

Since this package reads your lang files (and could theoretically read any other files as well), it is important to protect your API routes. Make sure that you only share the locales that you want to share. Add route pattern to do so.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-locale-via-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
spatie/laravel-package-tools Version ^1.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 empuxa/laravel-locale-via-api contains the following files

Loading the files please wait ....