PHPackages                             ursusarctosua/doctrine-timestamp - 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. ursusarctosua/doctrine-timestamp

ActiveLibrary[Database &amp; ORM](/categories/database)

ursusarctosua/doctrine-timestamp
================================

Realisation of timestamp MySQL type for Doctrine

v0.1.5(6y ago)085CC-BY-SA-4.0PHPPHP ^7.1CI failing

Since May 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/UrsusArctosUa/doctrine-timestamp)[ Packagist](https://packagist.org/packages/ursusarctosua/doctrine-timestamp)[ RSS](/packages/ursusarctosua-doctrine-timestamp/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

About
=====

[](#about)

This is MySQL timestamp type implementation for Doctrine ORM.

Using the datetime data type in MySQL may cause a problem when you make a DB connection with different [timezones](https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html). Instead, the timestamp data type is recommended to make DB server recalculate date values due to timezone.

As far as Doctrine has no type for MySQL timestamp, this lib implements it. It generates timestamp columns when datetimetz column type is specified in entity configuration. Also, to exclude timezone mismatch in DateTime object and MySQL connection, unix timestamp is used to transfer DateTime data from PHP to MySQL and vice versa.

Installation
------------

[](#installation)

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

```
composer require ursusarctosua/doctrine-timestamp
```

Configuration
-------------

[](#configuration)

### [Doctrine](https://www.doctrine-project.org/)

[](#doctrine)

Register this type with the Doctrine Type system and hook it into the database platform (see [Dotrine Custom Mapping Types](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#custom-mapping-types)):

```
