Download the PHP package knplabs/doctrine-behaviors without Composer
On this page you can find all versions of the php package knplabs/doctrine-behaviors. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download knplabs/doctrine-behaviors
More information about knplabs/doctrine-behaviors
Files in knplabs/doctrine-behaviors
Package doctrine-behaviors
Short Description Doctrine Behavior Traits
License MIT
Homepage http://knplabs.com
Informations about the package doctrine-behaviors
Doctrine Behaviors
This PHP library is a collection of traits and interfaces that add behaviors to Doctrine entities and repositories.
It currently handles:
- Blameable
- Loggable
- Sluggable
- SoftDeletable
- Uuidable
- Timestampable
- Translatable
- Tree
Install
Usage
All you have to do is to define a Doctrine entity:
- implemented interface
- add a trait
For some behaviors like tree, you can use repository traits:
Voilà!
You now have a working Category
that behaves like.
PHPStan
A PHPStan extension is available and provides the following features:
- Provides correct return type for
TranslatableInterface::getTranslations()
andTranslatableInterface::getNewTranslations()
- Provides correct return type for
TranslatableInterface::translate()
- Provides correct return type for
TranslationInterface::getTranslatable()
Include phpstan-extension.neon
in your project's PHPStan config:
3 Steps to Contribute
- 1 feature per pull-request
- New feature needs tests
- Tests and static analysis must pass:
Upgrade 1.x to 2
There have been many changes between 1 and 2, but don't worry. This package uses Rector, that handles upgrade for you.
Create rector.php
config:
Add Doctrine Behaviors upgrade set to rector.php
:
Run Rector:
All versions of doctrine-behaviors with dependencies
doctrine/common Version ^3.3
doctrine/persistence Version ^2.5|^3.0
doctrine/dbal Version ^3.3
doctrine/orm Version ^2.12
doctrine/doctrine-bundle Version ^2.6
symfony/cache Version ^5.4|^6.0
symfony/dependency-injection Version ^5.4|^6.0
symfony/http-kernel Version ^5.4|^6.0
symfony/security-core Version ^5.4|^6.0
symfony/framework-bundle Version ^5.4|^6.0
symfony/string Version ^5.4|^6.0
symfony/translation-contracts Version ^2.4|^3.0
nette/utils Version ^3.2
ramsey/uuid Version ^4.2