willdurand/propel-publishable-behavior
最新稳定版本:1.2.0
Composer 安装命令:
composer require willdurand/propel-publishable-behavior
包简介
关键字:
README 文档
README
The PublishableBehavior is designed to quickly add publish/unpublish features to your model.
Installation
Install the behavior in your project, the recommended way is to use Composer:
{
"require": {
"willdurand/propel-publishable-behavior": "dev-master"
}
}
Add the following line to your propel.ini or build.properties configuration file:
propel.behavior.publishable.class = vendor.willdurand.propel-publishable-behavior.src.PublishableBehavior
Note:
vendor.willdurand.propel-publishable-behavior.srcis the path of the behavior in dot-path notation.
Usage
ActiveRecord API
Returns true if the object is published, false otherwise:
isPublished()
Mark an object as published:
publish(PropelPDO $con = null)
Mark an object as not published:
unpublish(PropelPDO $con = null)
Has publication frame started ?
hasPublicationEnded()
Has publication frame started ?
hasPublicationStarted()
ActiveQuery API
Include unpublished objects in the results set:
includeUnpublished()
Filter by objects not published exclusively:
filterUnpublished()
Filter by objects published exclusively:
filterPublished()
Filter by publication active
filterByPublicationActive($date = 'now')
Mark an object as published:
publish(PropelPDO $con = null)
Mark an object as not published:
unpublish(PropelPDO $con = null)
Parameters
<behavior name="publishable"> <parameter name="is_published_column" value="is_published" /> <parameter name="published_by_default" value="false" /> <parameter name="include_unpublished" value="false" /> <!-- timeframe support --> <parameter name="with_timeframe" value="false" /> <parameter name="published_at_column" value="published_at" /> <parameter name="published_until_column" value="published_until" /> <!-- start and end value can be null --> <parameter name="require_start" value="false" /> <parameter name="require_end" value="false" /> </behavior>
Note: Parameter
include_unpublishedallows you to exclude unpublished object from each query. It is setup tofalseby default. If you don't want to exclude unpublished items, you have to set it totrue
Running tests
First of all, copy the phpunit.xml.dist to phpunit.xml.
If you did not install propel with composer, change PROPEL_DIR and PHING_DIR
values to customize the include path.
Customize autoloader by changing AUTOLOAD property.
then simply launch
$ vendor/bin/phpunit -c phpunit.xml
All green?
Credits
- William Durand william.durand1@gmail.com
- Julien Muetton julien_muetton@carpe-hora.com
willdurand/propel-publishable-behavior 适用场景与选型建议
willdurand/propel-publishable-behavior 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20.35k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2012 年 05 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「propel」 「Behavior」 「publishable」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 willdurand/propel-publishable-behavior 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 willdurand/propel-publishable-behavior 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 willdurand/propel-publishable-behavior 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A CakePHP plugin to provide easy access to zumba/swivel
This is a set of Yii2 behaviors extensions
A Laravel Eloquent model trait for publishable resource
A Laravel Nova package for publishable fields
A Laravel Filament package for publishable fields
Model behaviors for the li₃ PHP framework
统计信息
- 总下载量: 20.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 17
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2012-05-10