nycorp / lang-helper
Simple, structured and intuitive language helper generator for Laravel projects.
Fund package maintenance!
yann-yvan
Requires
- php: ^8.0
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- spatie/laravel-ray: ^1.35
README
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();
📊 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.