colbeh/consts
Tiny Laravel/PHP helper for defining and accessing class constants as “const sets.” Simplifies organizing enums-like values, retrieving constant lists, and keeping shared values centralized in a clean, reusable API.
Code Maintainability & Developer Experience (DX):
User::TABLE, Post::STATUS_DRAFT), cutting repetitive work and improving onboarding for new developers.Roadmap Prioritization:
php artisan const:generate) without manual updates, critical for staging/production parity.Use Cases:
DB::table('users') by replacing them with DB::table(User::TABLE).Order::STATUS_PENDING) to enforce consistency in API responses and validation rules.factory(User::class)->create(['role' => User::ROLE_ADMIN])).Adopt if:
Look elsewhere if:
*"This package automates the drudgery of managing database table/column constants in Laravel, saving our team hours per sprint on manual updates. By standardizing references like User::TABLE instead of hardcoded strings, we’ll:
php artisan command.
For a one-time setup cost, it’s a no-brainer for projects with >5 tables. Let’s pilot it in [Module X] and measure dev time saved."**"This is a low-risk, high-reward DX improvement:
php artisan const:generate to auto-create constants for tables/columns/enums in a Database facade (e.g., Database::USERS_TABLE). Supports custom naming conventions.Note: Given the package’s low stars/activity, vet its customization options (e.g., namespace control, partial generation) and CI/CD integration before adoption. Pair with a deprecation plan for existing hardcoded table names.
How can I help you explore Laravel packages today?