This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Automatic timestamps for Symfony entities.

2.1.0 2021-03-27 19:09 UTC

This package is not auto-updated.

Last update: 2021-09-11 21:16:22 UTC


  • symfony >= 3.0
  • php >= 7.0


Nothing special:

  1. composer require todstoychev/timestampable;
  2. Add to AppKernel
    new Todstoychev\Timestampable\TimestampableBundle(),


Entity that will use automatic timestamps should implement Todstoychev\TimestampableBundle\Entity\TimestampableInterface. The interface implementation is released in Todstoychev\TimestampableBundle\Entity\Timestampable trait. So in your entity:

use Todstoychev\TimestampableBundle\Entity\Timestampable;
use Todstoychev\TimestampableBundle\Entity\Timestampable;

class MyEntity implements TimestampableInterface
    use Timestampable;

Timestampable trait adds to entity 2 fields: createdAt and updatedAt. Describe those 2 in your entity configuration. If you are using anotations, override those 2 properties in your entity class.

That's all.