Download the PHP package kanekescom/laravel-lingo without Composer

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

Laravel Lingo

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Laravel package to manage, sync, and analyze JSON translation files.

Features

Key Concepts

Translation File Format

Lingo works with Laravel's JSON translation files (not PHP array files). These files are located at lang/{locale}.json:

Translation Status Detection

Lingo determines whether an item is translated or not by comparing the key and value:

Duplicate Detection

Since PHP automatically overwrites duplicate keys during json_decode(), Lingo uses regex on raw JSON content to detect duplicates before parsing:

How Source Scanning Works

The lingo:sync command and sync() method work by scanning your source code to find translation keys. The scanning process uses 4 regex patterns to detect Laravel translation function calls:

Pattern Detected Examples
__('...') __('Hello'), __("Welcome")
trans('...') trans('Save'), trans("Cancel")
@lang('...') @lang('Submit') (Blade directive)
Lang::get('...') Lang::get('Delete')

Scanning process:

  1. Resolve path โ†’ Relative paths are resolved via base_path(), absolute paths are used directly if they exist
  2. Recursive scan โ†’ For directories, all .php files are scanned recursively using RecursiveIteratorIterator
  3. Extract keys โ†’ Each file's content is matched against the 4 regex patterns above
  4. Deduplicate โ†’ All found keys are deduplicated using array_unique()

Sync Workflow

lingo:sync is the most powerful command. Here's how it works:

Steps:

  1. Scan all given paths (default: resources/views)
  2. Collect all translation keys found in source code
  3. Compare with existing keys in the JSON file
  4. Add missing keys (value = key, so they are easily identified as untranslated)
  5. Remove keys that are no longer used in source code
  6. Save the updated JSON file (sorted alphabetically)

File Path Resolution

All commands accept either a locale code or a direct file path:

File search order:

  1. base_path("lang/{locale}.json")
  2. lang_path("{locale}.json")
  3. resource_path("lang/{locale}.json")

Installation

Usage

Artisan Commands

All commands accept an optional locale argument. If omitted, defaults to config('app.locale').

Note: All paths are relative to your application root. Both files and directories are supported.

Programmatic Usage

Available Methods

Entry Points

Method Description
Lingo::locale('id') Load by locale โ†’ lang/id.json
Lingo::fromFile($path) Load from custom file path
Lingo::make($arr, $locale) Create from array with optional locale
lingo($arr, 'id') Helper: create from array with locale

Chainable Methods

Method Description
to($locale) Set target locale for save()
sync($paths) Sync with source files (accepts string, array, or null for default views). Supports files and directories.
sortKeys($asc) Sort keys alphabetically (default: A-Z)
clean() Remove empty values and sort keys
merge($arr) Merge with another array
add($keys) Add keys if not present
remove($keys) Keep only keys in list
removeEmpty() Remove empty values
onlyUntranslated() Filter to untranslated items
onlyTranslated() Filter to translated items
transform($fn) Transform translations with callback
tap($fn) Inspect translations without modifying

Output Methods

Method Description
save($path) Save to file (path optional)
toJson() Export as JSON string
get() Get translations array
toArray() Alias for get()
stats() Get translation statistics
count() Get number of translations
isEmpty() Check if translations empty
isNotEmpty() Check if translations not empty

Testing

Changelog

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

Contributing

Please see CONTRIBUTING for details.

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-lingo with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^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 kanekescom/laravel-lingo contains the following files

Loading the files please wait ...