Download the PHP package apih/laravel-jslang without Composer

On this page you can find all versions of the php package apih/laravel-jslang. 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-jslang

Laravel JS Lang

Latest Version on Packagist Total Downloads License

This package provides the ability to use all language localization messages from your Laravel-based app in browser's JavaScript. It also comes with a simple JavaScript Translator library that has some methods to interact with the messages.

Requirements

Installation

You can install the package via Composer:

The Apih\JsLang\JsLangServiceProvider class is auto-discovered and registered by default.

If you want to register it yourself, add the service provider in config/app.php:

You can publish the config file with:

You can publish the JavaScript Translator library with:

Usage

Testing

To test whether the installation is successful, you can run the following code:

It should output the URL and the JavaScript code for language localization messages.

Message Types

There are three message types:

JavaScript Files

By opening the URL generated by getUrl(), you will get the respective contents based on provided locale and type. By default, the contents are generated on runtime, unless you generate all the files beforehand, using the provided Artisan command.

Artisan Commands

You can generate all JavaScript files with:

By default, crc32 hashing algorithm is used to generate the contents' hash included in the filename. You can change the algorithm by using --hash-algo option. The following example uses sha256 hashing algorithm and only takes first 12 characters from the generated hash:

Generated files are placed in public/lang directory, based on the default config. It is recommended to put the directory in .gitignore file.

You can clear all generated files with:

Bootstrapping for Front-end

In order to use in front-end, several steps have to be taken. First, edit resources/js/app.js to add the JavaScript translator:

Then, use npm run dev or npm run prod to compile resources/js/app.js.

After that, you need to configure it in your page:

To test it, you can open the page in the browser and run the following code in the console to test it:

Security Vulnerabilities

If you discover any security related issues, please email [email protected] instead of using the issue tracker. Please prefix the subject with Laravel JS Lang:.

Credits

License

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


All versions of laravel-jslang with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^8.0|^9.0|^10.0|^11.0|^12.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 apih/laravel-jslang contains the following files

Loading the files please wait ....