nycorp/lang-helper

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

1.0.0 2025-04-26 16:42 UTC

This package is auto-updated.

Last update: 2025-04-27 01:28:22 UTC


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();

📊 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.