承接 paknahad/querifier 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

paknahad/querifier

Composer 安装命令:

composer require paknahad/querifier

包简介

A library to get requested query from the client and generate a query for Doctrine, Cake-php ORM or Laravel Eloquent

README 文档

README

Latest Stable Version Build Status License: MIT

Querifier

Installing

composer require paknahad/querifier

Usage

Symfony & Doctrine

<?php
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
use Paknahad\Querifier\Filter;
...
    $psrFactory = new DiactorosFactory();
    $psrRequest = $psrFactory->createRequest($request);

    $filter = new Filter($psrRequest);
    $filter->applyFilter($repository->createQueryBuilder('alias'));

Examples:

Expression:

http://example.com/books?q=title:php^author.name:hamid

Criteria:

http://example.com/books?filter[title]=php&filter[author.name]=hamid

SQL:

SELECT * FROM books AS b INNER JOIN authors AS a ...
WHERE
    b.title = 'php'
    AND
    a.name = 'hamid'

Advanced query:

Expression:

http://example.com/books?q=title:php^(author.name:%hamid%|(publish_date>2017-1-1^publish_date<2017-6-1))

Criteria:

books?filter[title]=php&filter[_c1][author.name][_like]=%hamid%&filter[_c2][publish_date][_gt]=2017-1-1&filter[_c3][publish_date][_lt]=2017-6-1]&filter[_c4][_cmb_and]=_c2,_c3&filter[_cmb_or]=_c4,_c1

SQL:

SELECT * FROM books AS b INNER JOIN authors  AS a …
WHERE
    b.title = 'php' 
    AND
    (
        (
            b.publish_date > '2017-1-1'
            AND
            B.publish_date < '2017-6-1'
        )
        OR
        a.name LIKE '%hamid%'
     )

Expression Parser

Simple query

simple query makes by this structure:

example.com?q=FIELD_NAME:VALUE

Advanced query:

Logical Operators:

  • ^ -> AND
  • | -> OR

Comparision Operators:

  • : -> Equal or LIKE in case there is a % in value.
  • :null => IS NULL
  • <> -> Not Equal or NOT LIKE in case there is a % in value.
  • <>null => IS NOT NULL
  • > -> Greather than
  • < -> Less than

Criteria Parser

Simple query

simple query makes by this structure:

url?filter[FIELD_NAME]=VALUE

Advanced query:

1- Define conditions.

url?filter[CONDITION NAME][FIELD NAME][OPERATOR]=VALUE

2- Combine these conditions together.

url?filter[CONDITION NAME][COMBINE]=CONDITIONS SEPARATED BY “,”
  • Condition name(optional) : An identifier for using in combinations, must be started by “_” and followed by AlphaNumeric characters
  • Operator name(optional , Default: _eq) : Name of an operator such as _eq, _not_eq, _in, _gt, _lt, _like.
  • Combine : use to combine two or more conditions : _cmb_or , _cmb_and

Sorting

  • Ascending on name field: http://example.com/books?sort=name
  • Decending on name field: http://example.com/books?sort=-name
  • Multiple fields: http://example.com/books?sort=city,-name
  • Field on a relation: http://example.com/books?sort=author.name

paknahad/querifier 适用场景与选型建议

paknahad/querifier 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18.26k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2019 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「symfony」 「php」 「parser」 「restful」 「doctrine」 「filter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 paknahad/querifier 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 paknahad/querifier 我们能提供哪些服务?
定制开发 / 二次开发

基于 paknahad/querifier 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-02