Download the PHP package sndwow/yii2-rest-query-helper without Composer

On this page you can find all versions of the php package sndwow/yii2-rest-query-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-rest-query-helper

概述

该扩展强化了Yii Restful查询。支持无限级关联

在关联查询数据时不是每次都回表查询,而是使用了with加载关联数据,由yii进行数据关系匹配,减少对数据库的访问。

URL 参数支持

url 关键字 解释 例子
eq 等于查询 api.com?id=eq:1 等价于 api.com?id=1
!eq 不等于 api.com?id=!eq:1,sql:id != 1
like 模糊查询 api.com?name=like:数据 ,sql:%数据%
llike 左模糊查询 api.com?name=llike:数据 ,sql:%数据
rlike 右模糊查询 api.com?name=rlike:数据 ,sql:数据%
null NULL 查询 api.com?name=null,sql: name IS NULL
!null NOT NULL 查询 api.com?name=!null,sql: name IS NOT NULL
less_than 小于查询 api.com?age=less_than:10,sql: age < 10
more_than 大于查询 api.com?age=more_than:10,sql: age > 10
less_than_eq 小于等于查询 api.com?age=less_than_eq:10,sql: age <= 10
more_than_eq 大于等于查询 api.com?age=more_than_eq:10,sql: age >= 10
in 范围查询 api.com?id=in:1,2,3,sql: id IN (1,2,3)
!in 排除范围查询 api.com?id=!in:1,2,3,sql: id NOT IN (1,2,3)

demo

url关键字 _sort

url关键字 _fields

url关键字 _expand

对应activeRecord内的relations。以上所有关联查询必须先在此参数中设定,否则无法查询到关联数据

例如需查询:books.name=like:自然,则必须先通过_expand关联books

控制层限制

为了防止预期外的查询,可设置相应的规则进行查询限制。

场景:

某些字段不允许like查询,或者只允许某个字段排序(其他字段排序可能造成性能问题)

可通过设置规则,仅对符合规则的url参数进行查询。

安装

建议通过 composer安装

也可手动安装到:/vendor/sndwow/yii2-rest-query-helper

需要修改vendor/yiisoft/extensions.php,配置中追加

使用

例子:

继承 yii\rest\ActiveController 用法

继承 yii\rest\Controller 用法


All versions of yii2-rest-query-helper with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sndwow/yii2-rest-query-helper contains the following files

Loading the files please wait ....