nycorp/lang-helper 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nycorp/lang-helper

最新稳定版本:1.0.2

Composer 安装命令:

composer require nycorp/lang-helper

包简介

Simple, structured and intuitive language helper generator for Laravel projects.

README 文档

README

Cover

Latest Version on Packagist Total Downloads

Simple, structured and intuitive language helper generator for Laravel projects.

✨ Features

  • 📁 Group by folders: Auto-organize translation keys into structured classes.
  • 💡 Intuitive access: Access translations like LangHelper::auth()->password()->reset().
  • 🔄 Nested keys support: Full nested language file support.
  • No language selection required: Automatically calls the default __('auth.password.reset') function.
  • ✏️ Detect unused lang file: Easily find and clean unused translation entries.

Installation

You can install the package via composer:

composer require --dev nycorp/lang-helper

⚙️ Usage

1. Generate LangHelper

php artisan lang:generate

This will create the app/Helpers/LangHelper.php and related group folders.

2. Detect Unused Translations

php artisan lang:generate --detect-unused

This will list all unused translation methods.

3. Example Usage

LangHelper::auth()->password()->reset();
LangHelper::validation()->email();
LangHelper::validation()->email($value);

non existing file will generate

LangHelper::navigation()->home();
// will return navigation.home

You can publish the config file with:

php artisan vendor:publish --tag="lang-helper-config"

This is the contents of the published config file:

return [
    'excluded_directories' => [
        'vendor'
    ],
    'excluded_lang_files' => [
        // auth
    ],
];

📊 Potential Updates

  • Fail safety like __()
  • Verify usage on all key branch
  • Auto-generate on file save (watch mode)
  • Add support for parameter placeholders
  • Blade components integration
  • Make group namespaces configurable

🚀 Contributing

We welcome contributions! ✨

  • Fork this repository
  • Create a feature branch (git checkout -b feature/my-feature)
  • Commit your changes
  • Push your branch (git push origin feature/my-feature)
  • Open a pull request!

We recommend clean, readable code and simple commit messages.

🙏 Thanks

This project was initially developed during a real-world Shortext need to simplify multilingual management in Laravel apps.

Enjoy! 🚀

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.

Made with ❤️ for Laravel developers.

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-26