muffin/orderly
Composer 安装命令:
composer require muffin/orderly
包简介
Default ordering (behavior) for CakePHP
README 文档
README
Allows setting default order for your tables.
Install
Using Composer:
composer require muffin/orderly
Then load the plugin using the console command:
bin/cake plugin load Muffin/Orderly
What is does
Orderly allow you to set default ORDER clause for your table's SELECT queries.
Usage
Here's how you can add the Orderly behavior for your tables:
// By default orders by display field of table. $this->addBehavior('Muffin/Orderly.Orderly'); // Default ordering using specified field. $this->addBehavior('Muffin/Orderly.Orderly', ['order' => $this->aliasField('field_name')]);
Value for order key can any valid value that \Cake\ORM\Query\SelectQuery::orderBy() takes.
The default order clause will only be applied to the primary query and when no
custom order clause has already been set for the query.
You can also configure the behavior to apply the default order based on required
condition using callback option. The order will be applied if callback returns true:
$this->addBehavior('Muffin/Orderly.Orderly', [ 'order' => ['Alias.field_name' => 'DESC'], 'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) { //return a boolean } ]);
The behavior can also be configured with multiple orders which are applied based on return value of their respective callbacks:
$this->addBehavior('Muffin/Orderly.Orderly', [ [ 'order' => ['Alias.field_name' => 'DESC'], 'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) { //return a boolean } ], [ 'order' => ['Alias.another_field'], 'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) { //return a boolean } ], ]);
Patches & Features
- Fork
- Mod, fix
- Test - this is important, so it's not unintentionally broken
- Commit - do not mess with license, todo, version, etc. (if you do change any, bump them into commits of their own that I can ignore when I pull)
- Pull request - bonus point for topic branches
To ensure your PRs are considered for upstream, you MUST follow the CakePHP coding standards.
Bugs & Feedback
http://github.com/usemuffin/orderly/issues
License
Copyright (c) 2015-Present, Use Muffin and licensed under The MIT License.
muffin/orderly 适用场景与选型建议
muffin/orderly 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 254.21k 次下载、GitHub Stars 达 22, 最近一次更新时间为 2016 年 02 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cakephp」 「muffin」 「orderly」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 muffin/orderly 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 muffin/orderly 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 muffin/orderly 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
CakePHP 3 authentication using the league/oauth2-client family
Security Tokens
FactoryMuffin support for CakePHP 3
CakePHP support for ID obfuscation
Email Toolkit Plugin for CakePHP
统计信息
- 总下载量: 254.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 22
- 点击次数: 24
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-02-04