Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Doctrine Behaviors

Doctrine Behaviors Laravel Package

miets/doctrine-behaviors

Doctrine ORM behavior extensions: reusable traits, event listeners and mappings that add timestampable, sluggable, soft-deletable, blameable and tree behavior to entities. Cuts boilerplate, keeps models clean, and drops into existing Doctrine setups with simple config.

View on GitHub
Deep Wiki
Context7

miets/doctrine-behaviors integrates the popular DoctrineBehaviors extension library into Laravel applications running Laravel Doctrine. Instead of writing repetitive entity code, you attach ready-made traits and interfaces to your models, and the package's listeners handle the rest—keeping your entities clean, consistent, and easy to maintain.

  • Timestampable — automatically sets createdAt and updatedAt values.
  • SoftDeletable — marks records as deleted without removing rows.
  • Blameable — records which user created or modified an entity.
  • Sluggable — generates unique URL-friendly slugs from any field.
  • Loggable — tracks entity changes as versioned history entries.

Drop-in traits mean minimal configuration and predictable behavior across all your Doctrine models.

Frequently asked questions about Doctrine Behaviors
Is miets/doctrine-behaviors compatible with Laravel?
It is a Doctrine ORM trait and event-subscriber library, not an Eloquent package. It can only work in a Laravel application that already uses Doctrine through something like laravel-doctrine/orm, and even then its Symfony bundle and DI wiring must be replaced with a Laravel service provider. In a standard Eloquent-based Laravel app there is nothing for its traits or subscribers to attach to.
How do I install miets/doctrine-behaviors in a Laravel app?
Install it with Composer and register its Doctrine event subscribers against Doctrine's EventManager. The package does not ship Laravel service provider wiring, so you must wire it yourself if you are using Doctrine on Laravel. Before committing, verify the PHP version floor and the supported Doctrine ORM major version in composer.json.
Does miets/doctrine-behaviors work with Laravel 11?
The package has no Laravel version constraint because it targets Doctrine and Symfony rather than Laravel itself. Laravel 11 compatibility depends on whether your app uses laravel-doctrine/orm and whether that integration accepts the package's subscribers unchanged. There is no official Laravel 11 integration or Laravel-side test signal in the package.
What Doctrine behaviors does miets/doctrine-behaviors include?
It provides reusable traits and event subscribers for behaviors such as Timestampable, Blameable, Sluggable, SoftDeletable, Translatable, Tree, Loggable, and Uuidable. These attach to Doctrine entities and are activated through Doctrine's event system. They are not Eloquent traits and do not operate on Eloquent models.
What are the Eloquent alternatives to doctrine-behaviors?
Laravel already provides native timestamps and SoftDeletes, and the community has maintained equivalents such as spatie/laravel-sluggable for slugs, astrotomic/laravel-translatable for translations, spatie/laravel-activitylog for blame and audit logging, and kalnoy/nestedset for trees. These are first-class Eloquent packages with active Laravel adoption. Reaching parity with Eloquent usually means not introducing Doctrine at all.
Is miets/doctrine-behaviors actively maintained?
The available signals point to a personal fork: 2 stars, 0 dependents, a single release dated 2024-02-07, and no visible CI or coverage signal. It appears to modernize the DoctrineBehaviors lineage for Symfony 7 and 6.4. Treat maintenance risk as high and check the divergence from upstream before relying on it in production.
How is miets/doctrine-behaviors different from KnpLabs/DoctrineBehaviors?
It is described as a fork of a fork of DoctrineBehaviors, updated to work with Symfony 7 and 6.4 where the official package does not work past Symfony 6.3. The core behavior set is inherited from the upstream DoctrineBehaviors lineage. Review the repository diff to see exactly which compatibility changes were made and whether the traits still depend on Symfony DI components.
Can I use miets/doctrine-behaviors without Symfony?
The traits may be framework-agnostic, but the package ships Symfony bundle and dependency-injection wiring. The critical question is whether the traits hard-depend on symfony/config, symfony/dependency-injection, or symfony/http-kernel at runtime. If they do, you would need to reproduce or bypass that wiring in Laravel.
Does miets/doctrine-behaviors support Doctrine ORM 3?
Doctrine ORM 2.x versus 3.x support is not confirmed by the provided context and is explicitly listed as a constraint to verify. Symfony 7 compatibility suggests a modern PHP floor, likely 8.2 or newer, but that does not guarantee ORM 3 support. Check composer.json and test the package against your actual Doctrine ORM version before adopting it.
How do I test miets/doctrine-behaviors in a Laravel app before adopting it?
Set up a throwaway Laravel app with laravel-doctrine/orm, register the package's subscribers against Doctrine's EventManager, and map a test entity using the traits you need. Verify attribute-based mapping versus annotation-based mapping if you have legacy entities. Because the package has no Laravel test suite, you own the integration coverage, so keep the evaluation time-boxed and abandon it if the app is Eloquent-first.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections