aw-studio/laravel-bitflags
Laravel Bitflags stores multiple boolean flags in a single integer column. It provides an Eloquent cast for toggling, checking, and querying bitwise options without extra database columns.
CastsAttributes implementation that matches current Laravel contracts, correct null → [] handling (the decbin(null) deprecation is exactly the kind of thing that bites in production on a PHP upgrade), plus helpers and query macros so filtering happens in SQL with bitwise operators rather than in PHP after loading rows.^0.1 and track it as tech debt," and it should be sequenced with the framework upgrade rather than after it.Adopt when most of these hold:
whereRaw('flags & ? = ?', ...) in every repository.Look elsewhere when:
flags = 13 is opaque to analysts; document the mapping or expose a view.^0.1, but treat it as a stopgap, not an adoption.For executives: This is a small, single-purpose open-source utility, not a platform bet. It removes one category of schema sprawl — the "we added eight boolean columns and a pivot table to track notification preferences" problem — and it just reached a 1.0 stable release, which means the API is committed and it isn't going to churn under us. Zero vendor lock-in: it's a thin cast over an integer column, so if we ever drop it we keep the data and delete a dependency.
For engineering: v1.0.0 is the first stable tag. It types the Bitflags cast to Laravel's current CastsAttributes contract, fixes null columns casting to [] (avoiding PHP's decbin(null) deprecation), and promotes illuminate/database and illuminate/contracts to explicit dependencies so installs are predictable. Breaking change: it requires PHP 8.2+ and Laravel 11–13; Laravel 8–10 and older PHP must stay on v0.1. No application code changes are needed for existing users of the cast, helpers, or query macros — the upgrade is composer require aw-studio/laravel-bitflags:^1.0. The tradeoff to document internally: bitmask columns are unreadable in raw SQL and in BI tools, so the flag-to-bit mapping belongs in the README and in code constants, not tribal knowledge.
How can I help you explore Laravel packages today?