Download the PHP package marcnewton/laravel-alsl without Composer

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

Laravel Accept-Language to SetLocale (ALSL)

Adds support for il8n Detection.

Iteration of a user's language preferences set in the Accept-Language request header, using order of language preference from users web browser; attempts to find a matching locale available in Laravel resources/lang directory.

Laravel ALSL

Installation

composer require marcnewton/laravel-alsl

Usage Information

app()->getLocale() will return the value of either the users web browser language preference or authenticated user locale attribute if present, as long as a matching ISO is found in the resources/lang directory else the app.locale config value will be used.

Language Variants

To support variants, create language translation folders in resources/lang.

For example, to support English (United States) and English (United Kingdom); create the following directories: en-US and en-GB in addition to en (English).

How detection works.

Web browsers are natively set to their systems user preferences for languages on installation and then further fallback preferences can be configured in the browser by the user, this information is sent with requests via a header called Accept-Language, it is a widely supported standard often overlooked.

The header is processed and a best match for laravels language directories is detected and set using Laravels built in locale functionality.

Here is an example of some different senarios for an individual whos preference is Mexican Spanish (español mexicano es-MX) and their secondary fallback is United States Spanish (Estados Unidos es-US):

Available Server Languages Matches
en, es_US, es es-US
en, es_US, es_MX, es es-MX
en, es es
en en
en, en_US, es_US, es_MX, es_CL es-MX

If the user only specified Spanish then this would match es but if the server only has en then it would present en.

However, if the user specified a preference for Spanish first then a Spanish variant, es would match first rather than the latter choices for variants unless the server does not have an es language folder, a variant folder will match else fallback to a configuration default.

Underscores from the Accept-Language header are converted to Hyphens to align with usages in PHP & Javascript localization methods.

Deployments

When adding or removing language support in resources/lang, you should ensure you run php artisan cache:forget resources.languages to clear the cache.


All versions of laravel-alsl with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4|^8.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 marcnewton/laravel-alsl contains the following files

Loading the files please wait ....