PHPackages                             xhyperf/model-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. xhyperf/model-timestamp

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

xhyperf/model-timestamp
=======================

v1.1.0(9mo ago)124MITPHPPHP &gt;=8.1

Since Jul 21Pushed 2mo agoCompare

[ Source](https://github.com/xhyperf/model-timestamp)[ Packagist](https://packagist.org/packages/xhyperf/model-timestamp)[ Docs](https://yangqi.co)[ RSS](/packages/xhyperf-model-timestamp/feed)WikiDiscussions main Synced 1mo ago

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

model-timestamp
===============

[](#model-timestamp)

数据表的时间字段使用时间戳格式，支持模型的软删除功能。

使用时间戳格式优点：

- 日志中时间为数字形式，可从数据库复制 `updated_at` 值直接在日志系统搜索，就可得到记录变更的相关日志

使用
==

[](#使用)

创建模型时，使用 `XHyperf\ModelTimestamp\Model` 代替 `Hyperf\Database\Model\Model`。

软删除模型
=====

[](#软删除模型)

模型需要使用 `XHyperf\ModelTimestamp\SoftDeletes` trait。

配置
==

[](#配置)

时间字段
----

[](#时间字段)

默认时间字段为 `created_at` 和 `updated_at`。

可以在模型中定义 `CREATED_AT` 和 `UPDATED_AT` 常量来指定时间字段。

软删除字段
-----

[](#软删除字段)

默认软删除字段为 `deleted_at`。

可以在模型中定义 `DELETED_AT` 常量来指定软删除字段。

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance74

Regular maintenance activity

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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 ~22 days

Total

2

Last Release

279d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/96c0aa2ed50163e2f0d9ea1eba22bbde1d63a11fc2e4fea1e14f9a2e1e6bf726?d=identicon)[xhyperf](/maintainers/xhyperf)

---

Top Contributors

[![iiQi](https://avatars.githubusercontent.com/u/3948037?v=4)](https://github.com/iiQi "iiQi (7 commits)")

---

Tags

phpswoolehyperfmodel-timestamp

### Embed Badge

![Health badge](/badges/xhyperf-model-timestamp/health.svg)

```
[![Health](https://phpackages.com/badges/xhyperf-model-timestamp/health.svg)](https://phpackages.com/packages/xhyperf-model-timestamp)
```

###  Alternatives

[hyperf/database-pgsql

A pgsql handler for hyperf/database.

12282.0k13](/packages/hyperf-database-pgsql)[jonas-elias/hyperf-oracle

A oracle handler for hyperf/database.

102.0k](/packages/jonas-elias-hyperf-oracle)[chadw/hyperf-database-sqlserver

Add Sql Server support to Hyperf

108.8k](/packages/chadw-hyperf-database-sqlserver)

PHPackages © 2026

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