gbenitez/attribute-bundle
gbenitez/attribute-bundle brings PHP 8 attribute-driven configuration to your application, letting developers declare metadata and behavior directly on classes and methods for cleaner, more maintainable code with less boilerplate.
v3.0.0 settles the framework question. The release notes name config/bundles.php, config/routes.yaml, bin/console, Twig, Doctrine, Symfony Form types and an OptionsResolver — this is unambiguously a Symfony bundle, not a Laravel package. There is no ServiceProvider, no config/*.php, no vendor:publish. Before anything else:
composer show gbenitez/attribute-bundle # verify name; GitHub repo is AttributeBundle
Inspect composer.json require for symfony/framework-bundle, doctrine/orm, twig/twig. If those are present (the notes imply all three), Composer will drag half of Symfony into a Laravel app if you force the install — don't.
Where to look first, in order:
INSTALLATION.md — new in v3.0.0; step-by-step, including the new-format bundles.php registration.src/Entity/Attribute.php (or equivalent) — the most important file to read. The notes describe full CRUD with a JSON column and migrations, which means "attribute" here may be a domain entity persisted in a database, not a PHP 8 attribute reflector. Resolve this ambiguity before assuming the package does reflection at all.src/Controller/ and src/Form/ — the Bootstrap 5 CRUD surface (list/create/edit/delete, CSRF-protected delete).TROUBLESHOOTING.md — new; usually the honest list of what breaks.tests/ — still the most reliable spec.First use case: for a Symfony 5.4–7.x app, it's an admin CRUD UI over an Attribute entity with Doctrine persistence (JSON column, SQLite/MySQL). For a Laravel team the day-one use case remains unchanged: read it, confirm whether it's a reflection helper or a CRUD domain model, and port only the part you need — almost certainly not the Twig templates or Symfony Form types.
If you run it as intended (Symfony): register in config/bundles.php, import routes in config/routes.yaml, run the Doctrine migration for the JSON column, and the CRUD works out of the box via autowired/autoconfigured services. Bootstrap 5 templates ship with it; override in templates/bundles/... only if pushed.
In Laravel — the honest port:
// Entity -> Eloquent model. Doctrine's JSON column maps to Laravel's json/array cast.
class Attribute extends Model
{
protected $casts = ['value' => 'array']; // replaces Doctrine json type
}
CRUD surface — rebuild, don't port. Symfony Form types, TranslatorInterface, Twig and OptionsResolver have no Laravel analogue worth carrying over. Use Filament/Nova (or Blade + Livewire) against the Eloquent model. The shape of the resource (list / create / edit / delete-with-confirmation, flash feedback) is worth copying; the code is not.
If the package turns out to also do PHP-attribute reading (verify src/), keep the prior pattern — declare attribute, scan namespace, cache the reflection map in a service provider, invalidate on deploy. Scanning is O(classes) and ReflectionClass is not OPcache-cached.
Isolate everything you borrow in app/Support/Attributes/ behind an interface you own. Bundles at this maturity get abandoned; you want to swap without a rewrite.
Prefer Laravel-native discovery (route/event discovery, #[Scope], container attributes) over standing up a parallel scanning or metadata system.
ReflectionClass::getAttributes() helper, verify before porting anything; the previous assessment's framing may have been wrong about the package's purpose.json column type for Laravel's json cast and writing a normal Laravel migration. SQLite/MySQL both fine; watch JSON operator differences if you query into the column.VerifyCsrfToken middleware and @csrf apply instead. Don't carry token fields across.bundles.php registration format, updated route imports, "clear cache and update the database". None of that concerns a Laravel app, but it means forks of v2.x are now diverged.INSTALLATION.md, TROUBLESHOOTING.md, README). Terminology won't match Laravel/Symfony English docs — budget for that.bin/console debug:router, debug:container, doctrine:schema:validate; Laravel side, ground truth is var_dump((new ReflectionClass($x))->getAttributes()), and when a registry comes back empty the cause is nearly always autoload/classmap (composer dump-autoload -o) or a namespace-path mismatch.#[Attribute(Attribute::IS_REPEATABLE)] where duplicates are expected.final, fork.ReflectionClass scanner or a Filament resource in-house. Pin an exact commit if you vendor anything, and assume no security patches or timely PHP-version bumps.How can I help you explore Laravel packages today?