- Does gedmo/doctrine-extensions work with Laravel Eloquent?
- No. Gedmo is not a Laravel package and does not integrate with Eloquent; it hooks into Doctrine ORM/ODM event listeners such as prePersist, onFlush, postFlush, and loadClassMetadata. To use it in Laravel, the application or a bounded context must already run Doctrine through a bridge such as laravel-doctrine/orm. Eloquent models will not receive Sluggable, Timestampable, Blameable, or the other behaviors.
- How do I install gedmo/doctrine-extensions in a Laravel application?
- Install it with composer require gedmo/doctrine-extensions after Doctrine ORM is already configured in the application. The package ships no Laravel service provider, so you must register the relevant listeners or subscribers yourself, attach them to the Doctrine entity manager, and annotate entities with attributes such as #[Gedmo\Timestampable]. The README points to a Laravel documentation page, but the actual wiring remains application code.
- Which behaviors does gedmo/doctrine-extensions provide?
- The package provides event-driven Doctrine behaviors including Sluggable for unique URL slugs, Timestampable for created and updated dates, Blameable for creator and updater tracking, Loggable for change history and versions, and Translatable for translated records. It also documents additional extensions such as SoftDeleteable, Tree, Sortable, and Uploadable. All of them are attached through Doctrine's event system rather than through Laravel-specific APIs.
- How do I register Gedmo Doctrine extension listeners in Laravel?
- Create an application service provider that registers the Gedmo listeners or event subscribers with Doctrine's event manager and ensures the entity manager is available to them. Then add the appropriate Gedmo attributes to your Doctrine entities and verify that each listener fires during flush. Because no Laravel service provider ships in the package, this integration and its configuration are your responsibility.
- Is gedmo/doctrine-extensions compatible with Doctrine ORM 3 and doctrine/persistence 4?
- Compatibility is arriving incrementally, extension by extension, rather than as a single package-wide guarantee. Version 3.22.2 includes a SoftDeleteable fix that resolves listeners through the ObjectManager, adding support for doctrine/persistence >= 4.0 and doctrine/event-manager >= 2.1, and it fixes TreeObjectHydrator compatibility with ORM 3 when parent properties are declared before children. Do not assume the other extensions are ready for persistence 4.0 until you have tested them, and pin your versions accordingly.
- What Laravel version does gedmo/doctrine-extensions support?
- The package does not target Laravel versions directly; it targets Doctrine ORM/ODM, PHP, and related Doctrine packages. Laravel compatibility therefore depends on the Doctrine bridge you choose, such as laravel-doctrine/orm, and on that bridge's release matrix. Check the bridge's supported Laravel and Doctrine versions before committing to an upgrade path.
- Why are my Timestampable or Sluggable fields empty after saving in Laravel?
- The most likely cause is that the relevant Gedmo listener or subscriber was not registered, or that an attribute was placed on the wrong property or class. These extensions degrade quietly rather than throwing when misconfigured, so you can get null timestamps or absent slugs without an obvious error. Verify Doctrine event registration and entity mapping, and add tests that assert the generated values after flush.
- What are alternatives to Gedmo for Laravel applications?
- If the application is committed to Eloquent, alternatives include built-in timestamp handling, custom traits for blameable fields, and third-party packages such as slugging libraries. Those solve individual chores but do not provide Gedmo's unified Doctrine behavior set. If you are already using Doctrine, Gedmo remains a mature option, but adopting it effectively means adopting Doctrine as a larger architectural commitment.
- Is gedmo/doctrine-extensions actively maintained?
- Yes. Release 3.22.2 is a patch release with forward-compatibility work for doctrine/persistence 4.0, a Tree nested-set correctness fix for multiple roots inserted in one flush, an ORM 3 TreeObjectHydrator fix, and a Loggable PHPDoc adjustment. That activity is evidence of maintenance, but it should not by itself accelerate adoption. Pin to at least 3.22.2 before writing nested-set Tree code.
- What should I check before using gedmo/doctrine-extensions in production?
- Evaluate the stack commitment first: using Gedmo in Laravel means running Doctrine, and the community-maintained Doctrine bridge trails Laravel and Doctrine major releases. Then cover the silent-failure behaviors with tests, review concurrency semantics for behaviors such as Sluggable and Tree, and gate compatibility per extension rather than per package. Budget for a persistence 4.0 upgrade instead of treating it as opportunistic, and pin versions in production.