beco/yii-common
Composer 安装命令:
composer require beco/yii-common
包简介
Common Yii2 base ActiveRecord and helpers
README 文档
README
Instalation
composer require beco/yii-common:dev-main
Provides
- new project creator (beco flavored)
beco\yii\db\ActiveRecord:- Human and Relative Dates automatic functions
beco\yii\models\User: a basic user model (and its migration)beco\yii\commands\SystemCommand: a command for- db backup
- system check
Images
add the following line to start.sh
./yii migrate --migrationPath=beco/yii/migrations/image --interactive=0
New project starter
Moved to beco\yii2-basic-template
Human, DateTime and Relative functions
If you have a field which is a date or a datetime column in mysql, aka
yyyy-mm-dd or yyyy-mm-dd hh:ii:ss, let's call it starts_at, by extending
beco\yii\db\ActiveRecord you automatically have three new functions:
$model->starts_atHumanreturns a nice print of the date as "jueves 2 de mayo del 2015 a las 12:34pm"$model->starts_atRelativereturns how much time is left for such date in a human way$model->starts_atDateTimea\DateTimerepresentation of such date
Automatically you also have starts_atHuman and startsAtHuman.
Info
Then, in order to get some local handling use intermediate classes:
<?php
namespace app\models;
use beco\yii\db\ActiveRecord as BaseActiveRecord;
abstract class ActiveRecord extends BaseActiveRecord {
}
Changelog
v0.1.10
- images central repository
- images auto upload to s3
v0.1.8
- spinoff; beco\yii-commons into beco\yii2-basic-template
v0.1.6
- adding debug component (depends on RBAC)
- fixing Yii inclusion in
beco\yii\web\Application
v0.1.5
- beats more info here
v0.1.2
- add
extra(json) to users - return null if date_time candidate's value is null
- minor fixes in relative time display
- add queue and mutex at composer level
- improved console and web config scritps
- includes Telegram basic client, command, migration and encapsulated response object
- all ActiveRecord are loggable
To do
[] separate system/new from system/setup only for config files rather than code files
[x] add LoginForm to templates
[] scheduler and beat
[x] include log capabilites to all ActiveRecord
[] improve documentation
[] should all tables from this packages be beco\yii\db\LoggableActiveRecordbeco_table_name?
beco/yii-common 适用场景与选型建议
beco/yii-common 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 179 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 beco/yii-common 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 beco/yii-common 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 179
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-19