hyperf/translation

An independent translation component, forked by illuminate/translation.
2,395,154 7
Install
composer require hyperf/translation
Latest Version:v3.2.0
PHP:>=8.2
License:MIT
Last Updated:Jun 7, 2026
Links: GitHub  ·  Packagist
Maintainer: hyperf

Hyperf Translation

hyperf/translation 组件衍生于 Laravel Translation 组件的,我们对它进行了一些改造,大部分功能保持了相同。在这里感谢一下 Laravel 开发组,实现了如此强大好用的 Translation 组件。

Installation

composer require hyperf/translation

Configuration

Publish config

php bin/hyperf.php vendor:publish hyperf/translation

Config files:

+ ./config/autoload/translation.php

Configuration

<?php
declare(strict_types=1);

return [
    'locale' => 'en',   
    'fallback_locale' => '',
    'path' => BASE_PATH . '/storage/languages', 
];

Usage

$container = ApplicationContext::getContainer();
$translator = $container->get(\Hyperf\Contract\TranslatorInterface::class);
$translator->trans('validation.accepted');

Related Packages

hyperf/scout

Hyperf Scout provides a driver based solution to searching your Eloquent models....

190,227 6
jildertmiedema/translation-check

Checks if all translation items appear in all languages

783 1
limingxinleo/i-encryption

Illuminate Encryption for Hyperf

642 6
onix-systems-php/hyperf-inertia

The Hyperf adapter for Inertia.js.

248 4
jmiy/hyperf-i-cache-3-2

Illuminate Cache for Hyperf

42 0

Version History

Version Released PHP License
v3.2.0 >=8.2 MIT
v3.1.63 >=8.1 MIT
v3.1.57 >=8.1 MIT
v3.1.42 >=8.1 MIT
v3.1.35 >=8.1 MIT
Pre-releases (13)
Version Released PHP License
v3.2.0-alpha.3 >=8.2 MIT
v3.2.0-alpha.1 >=8.2 MIT
v3.1.0-rc.11 >=8.1 MIT
v3.1.0-rc.4 >=8.1 MIT
v3.1.0-alpha.1 >=8.1 MIT