laracraft-tech/laravel-useful-traits
Laravel package with handy daily-use additions: traits for PHP 8.1+ enums (get names/values/array) and Eloquent query scopes (e.g., select all columns except specific ones, date-based scopes), plus an Artisan db:truncate command.
Developer Productivity & Velocity:
UsefulScopes trait (selectAllBut, fromToday, fromYesterday) reduces repetitive query logic, enabling teams to ship features faster by avoiding custom scope implementations. Ideal for projects with high query volume (e.g., analytics dashboards, reporting tools).UsefulEnums accelerates enum-to-array conversions for migrations, validation, and UI components (e.g., dropdowns). Critical for scalable applications where enums are heavily used (e.g., e-commerce product categories, permission systems).db:truncate command reduces CI feedback loops by providing a faster alternative to migrate:fresh for local/dev environments, directly impacting developer happiness and release velocity.Technical Debt Reduction:
select clauses with excluded columns), reducing technical debt in legacy codebases.Cost Efficiency:
Use Cases:
db:truncate command cuts test suite execution time, enabling faster iterations in pipelines.Adopt If:
Look Elsewhere If:
For Executives:
"This package cuts developer friction by standardizing repetitive Laravel patterns—like dynamic column exclusion and date-based queries—saving our team hours per sprint on boilerplate code. For example, UsefulScopes replaces 20+ lines of custom query logic with a single trait, while the db:truncate command reduces CI feedback loops by 30% for our data-heavy applications. It’s a low-risk, high-reward investment: MIT-licensed, actively maintained, and aligned with our Laravel 12 roadmap. The payoff? Faster feature delivery and fewer bugs from inconsistent queries."
For Engineering Leaders: *"This solves three key pain points:
UsefulScopes enforces standardized patterns (e.g., selectAllBut) across the codebase, reducing tech debt.UsefulEnums simplifies migrations/validation for teams using enums heavily (e.g., permissions, product categories).db:truncate command dramatically speeds up local/dev workflows, cutting test suite times in half for large databases.
It’s a drop-in solution with zero runtime overhead—just publish the config and start using the traits. No vendor lock-in, and it’s battle-tested in Laravel 11–13."*For Developers: *"This package gives you superpowers for common Laravel tasks:
select('col1', 'col2') again: Use selectAllBut(['col3']) to exclude columns dynamically.PaymentType::names() → ['Pending', 'Failed']—perfect for migrations or dropdowns.db:truncate wipes your database in seconds, not minutes.
It’s zero-config (just composer require and php artisan vendor:publish), and the traits are self-documenting. Start using it today—your future self will thank you."*How can I help you explore Laravel packages today?