PHPackages                             harp-orm/timestamps - 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. harp-orm/timestamps

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

harp-orm/timestamps
===================

Automatic createdAt and updatedAt properties

0.3.0(11y ago)01321BSD-3-ClausePHPPHP &gt;=5.4.0

Since Jun 26Pushed 11y ago1 watchersCompare

[ Source](https://github.com/harp-orm/timestamps)[ Packagist](https://packagist.org/packages/harp-orm/timestamps)[ RSS](/packages/harp-orm-timestamps/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (2)Versions (4)Used By (1)

Timestamps
==========

[](#timestamps)

[![Build Status](https://camo.githubusercontent.com/98c5f6b816059e75f7e1712186dd668183332f39013eb856cd2b91ea5697a2d4/68747470733a2f2f7472617669732d63692e6f72672f686172702d6f726d2f74696d657374616d70732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/harp-orm/timestamps)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/09be5a8e830715020d4571e40ac163bf42eca655755cf6fce4d30cf732d64093/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f686172702d6f726d2f74696d657374616d70732f6261646765732f7175616c6974792d73636f72652e706e67)](https://scrutinizer-ci.com/g/harp-orm/timestamps/)[![Code Coverage](https://camo.githubusercontent.com/798af70ff1bd242bc8ec9fb0e81f52438428aec3a891a67bcfd5e50f8f347eb3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f686172702d6f726d2f74696d657374616d70732f6261646765732f636f7665726167652e706e67)](https://scrutinizer-ci.com/g/harp-orm/timestamps/)[![Latest Stable Version](https://camo.githubusercontent.com/eddba1d046e7415a3ee587ee18f4a4529f4ea0feaf9947418ad5935d120724a3/68747470733a2f2f706f7365722e707567782e6f72672f686172702d6f726d2f74696d657374616d70732f762f737461626c652e706e67)](https://packagist.org/packages/harp-orm/timestamps)

Automatic createdAt and updatedAt properties

Usage
-----

[](#usage)

Add the triats to the Repo and Model classes:

```
use Harp\Harp\AbstractModel;
use Harp\Timestamps\TimestampsTrait;

class User extends AbstractModel
{
    use TimestampsTrait;

    public static function initialize($config)
    {
        // Adds events to populate the properties
        TimestampsTrait::initialize($config);
    }
}
```

**Database Table:**

```
┌─────────────────────────┐
│ Table: Category         │
├─────────────┬───────────┤
│ id          │ ingeter   │
│ name        │ string    │
│ createdAt*  │ timestamp │
│ updatedAt*  │ timestamp │
└─────────────┴───────────┘
* Required fields

```

Interface
---------

[](#interface)

```
echo $user->createdAt; // 2014-01-01 00:00:00
echo $user->updatedAt; // 2014-01-01 00:00:00

echo $user->getCreatedAt(); // DateTime object
$user->setCreatedAt(new DateTime());

echo $user->getUpdatedAt(); // DateTime object
$user->setUpdatedAt(new DateTime());
```

Testing
-------

[](#testing)

You can set the "current date" that the the trait uses with the "TimestampsTrait::setCurrentDate($date)" method.

```
TimestampsTrait::setCurrentDate('2014-03-01 10:00:00');

$user = new User();

echo $user->createdAt; // 2014-03-01 10:00:00
echo $user->updatedAt; // 2014-03-01 10:00:00
```

License
-------

[](#license)

Copyright (c) 2014, Clippings Ltd. Developed by Ivan Kerin

Under BSD-3-Clause license, read LICENSE file.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Total

3

Last Release

4320d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/506129?v=4)[Harry Dobrev](/maintainers/hkdobrev)[@hkdobrev](https://github.com/hkdobrev)

---

Top Contributors

[![ivank](https://avatars.githubusercontent.com/u/4976?v=4)](https://github.com/ivank "ivank (27 commits)")

### Embed Badge

![Health badge](/badges/harp-orm-timestamps/health.svg)

```
[![Health](https://phpackages.com/badges/harp-orm-timestamps/health.svg)](https://phpackages.com/packages/harp-orm-timestamps)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M543](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M209](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
