Download the PHP package artryazanov/artisan-translator without Composer

On this page you can find all versions of the php package artryazanov/artisan-translator. 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 artisan-translator

Artisan Translator for Laravel

Artisan Translator streamlines the localization workflow in Laravel applications. It automates the extraction of strings from Blade templates, translates them using Google's Gemini AI, and helps keep your language files clean by removing unused keys.

Tests Pint Latest Version on Packagist Total Downloads PHP Version Laravel Version

Key Features

Requirements

Installation

Install the package via Composer:

The package will automatically register its service provider.

Setup

  1. Get a Gemini API Key: Obtain an API key from Google AI Studio.
  2. Configure Environment: Add the key to your .env file:

  3. (Optional) Publish Configuration: Customise default settings by publishing the config file:

Usage

1. Extract Strings

Scan your resources/views directory to find static strings, replace them with translation keys in the Blade files, and save the original strings to your source language files (default: en).

Options:

๐Ÿ“ What strings are extracted?

The command scans for strings wrapped in __('...') or @lang('...'). It intelligently distinguishes between "plain text" that needs extraction and existing translation keys.

String Type Example Action Reason
Plain Text __('Hello World') โœ… Extract Contains spaces or punctuation.
Plain Text @lang('Click here') โœ… Extract Contains spaces.
Existing Key __('messages.welcome') โŒ Ignore Looks like a key (dots, no spaces).
Existing Key @lang('auth.failed') โŒ Ignore Looks like a key.
Existing Key __('forms/user.email') โŒ Ignore Looks like a key (slashes allowed).

2. Translate with AI

Translate your extracted strings from the source language to one or more target languages using Gemini.

Arguments & Options:

Note: If you have mcamara/laravel-localization installed, the package can automatically detect supported locales if you omit --targets.

3. Cleanup Unused Translations

Keep your language files tidy by removing keys that are no longer referenced in your codebase.

Options:

Configuration

Main Config (config/artisan-translator.php)

Option Env Variable Default Description
source_language ARTISAN_TRANSLATOR_SOURCE_LANG en The source language of your application.
lang_root_path ARTISAN_TRANSLATOR_LANG_ROOT blade Subdirectory under resources/lang/{locale} where files are stored.
ai_request_delay_seconds ARTISAN_TRANSLATOR_AI_DELAY 2.0 Minimum delay between AI API requests to avoid rate limits.
gemini.api_key GEMINI_API_KEY - Your Google Gemini API Key.
gemini.model GEMINI_MODEL gemma-3-27b-it The AI model to use.

Cleaner Config (config/translation-cleaner.php)

Supported AI Models

You can use any string supported by the Gemini API, or one of the built-in Enum values:

Testing

Run the test suite to ensure everything is working correctly:

License

MIT. See LICENSE.


All versions of artisan-translator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
illuminate/console Version ^11.0|^12.0
illuminate/filesystem Version ^11.0|^12.0
symfony/finder Version ^7.0
google-gemini-php/laravel Version ^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 artryazanov/artisan-translator contains the following files

Loading the files please wait ...