PHPackages                             andanteproject/timestampable-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. andanteproject/timestampable-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

andanteproject/timestampable-bundle
===================================

A Symfony Bundle to handle entities createdAt and updatedAt dates with Doctrine

3.1.0(2mo ago)870.9k↓28.1%3MITPHPPHP ^8.2CI passing

Since Mar 2Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/andanteproject/timestampable-bundle)[ Packagist](https://packagist.org/packages/andanteproject/timestampable-bundle)[ RSS](/packages/andanteproject-timestampable-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (13)Versions (15)Used By (0)

[![Andante Project Logo](https://github.com/andanteproject/timestampable-bundle/raw/main/andanteproject-logo.png?raw=true)](https://github.com/andanteproject/timestampable-bundle/blob/main/andanteproject-logo.png?raw=true)

Timestampable Bundle
====================

[](#timestampable-bundle)

#### Symfony Bundle - [Andante Project](https://github.com/andanteproject)

[](#symfony-bundle---andante-project)

[![Latest Version](https://camo.githubusercontent.com/bc6d0c0874c80ce228648a1e8f7ef36cd6e4657081d2107bd338e7f2e3d5cab1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f616e64616e746570726f6a6563742f74696d657374616d7061626c652d62756e646c652e737667)](https://github.com/andanteproject/timestampable-bundle/releases)[![Github actions](https://github.com/andanteproject/timestampable-bundle/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/andanteproject/timestampable-bundle/actions/workflows/ci.yml/badge.svg?branch=main)[![Framework](https://camo.githubusercontent.com/1fe7103246b48eda44b5575f9866f203abc111d74aa294f76cf3edc2c738ca6d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d352e78253743362e78253743372e78253743382e782d696e666f726d6174696f6e616c3f5374796c653d666c6174266c6f676f3d73796d666f6e79)](https://camo.githubusercontent.com/1fe7103246b48eda44b5575f9866f203abc111d74aa294f76cf3edc2c738ca6d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d352e78253743362e78253743372e78253743382e782d696e666f726d6174696f6e616c3f5374796c653d666c6174266c6f676f3d73796d666f6e79)[![Php8](https://camo.githubusercontent.com/69a836f4b5295668eddf897470a0664ef38350966b55a73f5f21f2f60dbacb3f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e782d696e666f726d6174696f6e616c3f7374796c653d666c6174266c6f676f3d706870)](https://camo.githubusercontent.com/69a836f4b5295668eddf897470a0664ef38350966b55a73f5f21f2f60dbacb3f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e782d696e666f726d6174696f6e616c3f7374796c653d666c6174266c6f676f3d706870)[![PhpStan](https://camo.githubusercontent.com/90942adff622b021d26f75557b19c65a3b48553af26cb951fdb9a9f0e587743d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230382d737563636573733f7374796c653d666c6174266c6f676f3d706870)](https://camo.githubusercontent.com/90942adff622b021d26f75557b19c65a3b48553af26cb951fdb9a9f0e587743d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230382d737563636573733f7374796c653d666c6174266c6f676f3d706870)

A Symfony Bundle to handle entity `createdAt` and `updatedAt` dates with Doctrine. 🕰

Requirements
------------

[](#requirements)

Symfony 5.x–8.x and PHP 8.2.

Install
-------

[](#install)

Via [Composer](https://getcomposer.org/):

```
$ composer require andanteproject/timestampable-bundle
```

Features
--------

[](#features)

- No configuration required to get started; fully customizable;
- `createdAt` and `updatedAt` properties are `?\DateTimeImmutable`;
- Uses [Symfony Clock](https://symfony.com/doc/current/components/clock.html);
- Does not override your `createdAt` and `updatedAt` values when you set them explicitly;
- No annotations or attributes required;
- Works like magic ✨.

Basic usage
-----------

[](#basic-usage)

After [install](#install), ensure the bundle is registered in your Symfony bundles list (`config/bundles.php`):

```
return [
    // ...
    Andante\TimestampableBundle\AndanteTimestampableBundle::class => ['all' => true],
    // ...
];
```

This is done automatically if you use [Symfony Flex](https://flex.symfony.com). Otherwise, register it manually.

Suppose you have an `App\Entity\Article` Doctrine entity and want to track created and updated dates. Implement `Andante\TimestampableBundle\Timestampable\TimestampableInterface` and use the `Andante\TimestampableBundle\Timestampable\TimestampableTrait` trait.

```
