roydejong/php-activerecord-utils
Composer 安装命令:
composer require roydejong/php-activerecord-utils
包简介
Utilities for composing queries in php-activerecord.
README 文档
README
Simple utilities that make writing php-activerecord queries more convenient.
Getting started
Add this library as a Composer dependency:
composer require roydejong/php-activerecord-utils
Once included, you'll be able to autoload the desired classes from the ActiveRecordUtils\ namespace.
Conditions
ActiveRecordUtils\Composers\Conditions lets you elegantly compose readable conditions parameters for activerecord queries.
Basic usage
<?php
use ActiveRecordUtils\Composers\Conditions;
Conditions::make()
->where('employee_id = ?', 123)
->or('login_id = ?', 123)
->andWhere('is_enabled = 1')
->value();
// Returns: ["(employee_id = ? OR login_id = ?) AND (is_enabled = 1)", 123, 123]
Features
- 📝 Better syntax: Programmatically compose your WHERE clauses with a syntax that's easier to read and more convenient to maintain.
- ➕ Easy grouping: Use
andWhere(),orWhere()to start a new parentheses group, or useand(),or()to add another condition to he current group. - ✅ Auto validation: Issues like wrong parameter count are automatically detected and produce convenient and readable error messages.
统计信息
- 总下载量: 359
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-28