Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/KnpLabs/DoctrineBehaviors

Doctrine2 behavior traits that help handling Blameable, Loggable, Sluggable, SoftDeletable, Uuidable, Timestampable, Translatable, Tree behavior
https://github.com/KnpLabs/DoctrineBehaviors

behavior doctrine doctrine2 orm php trait

Last synced: 3 months ago
JSON representation

Doctrine2 behavior traits that help handling Blameable, Loggable, Sluggable, SoftDeletable, Uuidable, Timestampable, Translatable, Tree behavior

Awesome Lists containing this project

README

        

# Doctrine Behaviors

[![Downloads](https://img.shields.io/packagist/dt/knplabs/doctrine-behaviors.svg?style=flat-square)](https://packagist.org/packages/knplabs/doctrine-behaviors)

This PHP library is a collection of traits and interfaces that add behaviors to Doctrine entities and repositories.

It currently handles:

* [Blameable](/docs/blameable.md)
* [Loggable](/docs/loggable.md)
* [Sluggable](/docs/sluggable.md)
* [SoftDeletable](/docs/soft-deletable.md)
* [Uuidable](/docs/uuidable.md)
* [Timestampable](/docs/timestampable.md)
* [Translatable](/docs/translatable.md)
* [Tree](/docs/tree.md)

## Install

```bash
composer require knplabs/doctrine-behaviors
```

## 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:

```php
import(DoctrineSetList::DOCTRINE_BEHAVIORS_20);
};
```

Run Rector:

```bash
vendor/bin/rector process src
```