laracraft-tech/laravel-useful-traits
Laravel Useful Additions is a small collection of handy traits and commands for everyday Laravel work, including enum helpers (names, values, array), query scopes like selectAllBut and fromToday/fromYesterday, plus a db:truncate artisan command.
names(), values(), array()), three query scopes, a truncate command. The PM decision is not "should we depend on this?" but "do we accept a third-party dependency for code we could own in an afternoon?" Default answer: only adopt if multiple services need the same helpers and we want one canonical implementation.UsefulEnums is genuinely useful when modeling order statuses, ticket states, or role enums and you need names()/values() for validation rules, seeders, and admin dropdowns. It removes a repeated boilerplate block per enum.fromToday() / fromYesterday() map directly to "today's orders," "yesterday's signups," daily-digest dashboards. Cheap to adopt, but equally cheap to write — do not let it drive architecture.db:truncate (with table filtering, foreign-key toggle, force mode) is a real convenience for local staging resets and demo-data refresh. Treat it as an internal ops utility only, never a production path.RefreshDatabaseFast in v4.2.0 and now recommends Laravel's built-in RefreshDatabase. Do not build a test-infrastructure roadmap around this package; that lane is closed by the author's own advice.selectAllBut to avoid leaking large columns), CI/dev database resets (db:truncate), enum-driven form validation. None of these are differentiated product capabilities — they are velocity, not strategy.Consider it when:
UsefulEnums helpers would be used across several enums and several services, making a shared dependency preferable to per-repo copy-paste.db:truncate-style convenience tooling for local/CI environments and want it as a command rather than a bespoke script.Look elsewhere (or write it yourself) when:
selectAllBut in hot paths. It works by introspecting and caching your table's column list, and the cache only invalidates when files are added/removed in the migrations directory — not when an existing migration file is edited. That is a documented footgun: a deploy that alters a column set without adding/removing a migration file can silently select a stale column list. If you adopt it, you must own a deploy step that clears this cache, and you should question whether Model::getConnection()->getSchemaBuilder()->getColumnListing() inline is safer for your team.RefreshDatabaseFast is deprecated and the author flags a real failure mode (aborted tests leave data behind, because rollback never fires). Use Laravel's RefreshDatabase.db:truncate with a --force option is a loaded gun. If adopted, it must be environment-gated, not merely password-gated.Net PM recommendation: treat this as a reference implementation and idea source, not a platform dependency. Adopt selectively — UsefulEnums is the only piece with meaningful reuse value — and only after confirming the maintenance burden (cache invalidation on deploy) is owned by someone.
For executives (30 seconds): This is a tiny, free, open-source helper library for our Laravel codebase. It removes repetitive boilerplate around enum handling, date-based queries, and dev-database resets. It will not change our product or our roadmap, and it introduces no cost or licensing risk. My recommendation is to borrow the patterns rather than take a hard dependency — we get the same velocity benefit with zero vendor exposure, since the code involved is roughly the size of a single pull request.
For engineering leads: Two of the four features are worth taking and two are not. UsefulEnums is the strongest candidate — it collapses the names()/values()/array() boilerplate we rewrite for every enum, and it's actively maintained against current Laravel releases. db:truncate is a reasonable local/CI convenience but must never be reachable in production. RefreshDatabaseFast is deprecated by its own author in favor of Laravel's built-in RefreshDatabase — we should not adopt it, and if we already have it, removing it is the roadmap item. selectAllBut carries a real operational caveat: it caches table column names and only re-caches when migration files are added or removed, not when their contents change, so it requires a deploy-time cache clear. If anyone wants it, we budget that follow-up work explicitly.
For the decision record: Recommendation is selective adoption or inline vendoring, with an explicit note that the package has ~58 GitHub stars and no known dependents — it is unproven in the wild, so we confine it to non-critical paths and avoid it in anything touching money, auth, or data integrity. Cost: zero. Risk: low, but non-zero and entirely concentrated in selectAllBut and db:truncate. Revisit if the utility set grows or if community adoption materializes.
How can I help you explore Laravel packages today?