halalsoft/laravel-dynamic-column
A Laravel package for adding dynamic columns to Eloquent models, making it easier to support flexible custom fields and extra attributes without hardcoding every column in your migrations.
halalsoft/laravel-dynamic-column is a small, early-stage package (still on 0.1.x) for attaching columns/attributes to Eloquent models at runtime rather than through a schema migration. The v0.1.3 release is a single bug fix (issue #6) — no API additions, no deprecations — so treat this as a stability patch rather than a feature release.
First steps:
composer require halalsoft/laravel-dynamic-column:^0.1.3 — pin the minor version, the public API is not yet stable.php artisan vendor:publish --provider="HalalSoft\DynamicColumn\...ServiceProvider" (config and any migration). Read the published config before running anything — the defaults tell you more about the intended storage model than the README does.src/ first (it is small), then the issue tracker. With a package this young, the tests and the GitHub issues are the real documentation.Best first use case: a model that needs user-defined or per-tenant extra fields (custom profile attributes, product metadata) without a migration for every new field. Start with one model and one column definition before generalising.
use DynamicColumn; on the Eloquent model plus a definition of which columns are dynamic. Keep that definition in one place (a config array or a dedicated service) so it can be cached and validated centrally.DynamicColumn::make('vat_number')->string()->nullable()) rather than scattering raw strings through controllers. This is what makes the package survive the next 0.1.x bump.0.1.x API directly.0.1.x means breaking changes are legitimate on a patch bump until 1.0. Pin exactly (0.1.3) in composer.json and read each release note before upgrading.WHERE and ORDER BY. Verify index support on your engine before building list screens on top of it.$fillable or $hidden automatically. Decide explicitly whether they're fillable and whether they appear in toArray()/API resources.0.1.x, forks are cheap but merge cost is high.How can I help you explore Laravel packages today?