定制 php-platform/search-query-parser 二次开发

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

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

php-platform/search-query-parser

Composer 安装命令:

composer require php-platform/search-query-parser

包简介

a library to parse search query parameters from a rest request

README 文档

README

Build Status

When a Model from php-platform/persist is exposed as REST Resource (php-platform/restful), It is required that the REST End point to list all resources must support filter , sort and pagination

Models extending php-platform/persist supports filter , sort and pagination through arguments to PhpPlatform\Persist\Model::find($filters,$sort,$pagination,$where) method

So this library parses query parameters from rest endpoint to method arguments required by PhpPlatform\Persist\Model::find($filters,$sort,$pagination,$where)

How to use

$searchParams = PhpPlatform\SearchQueryParser\Parser::parse(PhpPlatform\RESTFul\HTTPRequest $request,string $modelClassName, array $excludeFromFullTextSearch);

where

  • $request is the HTTPRequest object received in the rest service
  • $modelClassName is the full name of the Model which is served as REST Resource
  • $excludeFromFullTextSearch is the array of fields which needs to be excluded from performing full text search

returns

An instance of PhpPlatform\SearchQueryParser\FindParams

Parse rules

Query Param Method Parameter Format
q $where string for full text search , a complex $where expression is formed matching all the get fields from the Model , excluding the once mentioned in $excludeFromFullTextSearch. Auto Increment fields are excluded by default
f $filters base64 encoded json string representing the $filters object
s $sort base64 encoded json string representing the $sort object
p $pagination '<pageNumber>-<pageSize>'

Note 1 : This API throws PhpPlatform\Errors\Exceptions\Http\_4XX\BadRequest Exception if the query parameters are invalid Note 2 : All of the above query parameters are optional

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2018-02-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固