定制 jayparmar271/cakephp-magic-query 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jayparmar271/cakephp-magic-query

Composer 安装命令:

composer require jayparmar271/cakephp-magic-query

包简介

MagicQuery plugin for CakePHP

README 文档

README

Latest Stable Version Total Downloads License Tests PHPStan Check Coding Style Check

Simple query builder made with CakePHP

Requirements

  • CakePHP 3.5+

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require jayparmar271/cakephp-magic-query

Usage

  1. Add behavior in your table. (../src/Model/Table/UsersTable.php)
    $this->addBehavior('MagicQuery.Query');
  1. Use getRecord() to get single record.
    $this->Users->getRecord(['name'], ['id' => '1']);

To set default options:

  1. Create new config file and add your default options. (/config/magic_query.php)
return [
  'MagicQuery' => [
    'limit' => 2,
    'page' => 1,
    'orderBy' => ['id' => 'ASC'],
    'hydrate' => false,
    'validate' => true,
  ],
];
  1. Load into your bootstrap.php (/config/bootstrap.php)
/*
 * Load magic query file
 */
if (file_exists(CONFIG . 'magic_query.php')) {
    Configure::load('magic_query');
}

That's all. Enjoy!

You can find more examples here.

License

The MIT License. Please see License File for more information.

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固