nasustop / hapi-base
3.0.1
2023-12-30 10:03 UTC
Requires
- php: >=8.0
- hyperf/cache: ~3.0.0
- hyperf/command: ~3.0.0
- hyperf/contract: ~3.0.0
- hyperf/crontab: ~3.0.0
- hyperf/database: ~3.0.0
- hyperf/db-connection: ~3.0.0
- hyperf/http-server: ~3.0.0
- nasustop/hapi-helpers: ~3.0.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- mockery/mockery: ^1.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: >=7.0
- swoole/ide-helper: ^4.5
Suggests
- swow/swow: Required to create swow components.
README
使用Hyperf框架时,一些基础类的集合
Repository
新建repository类App\Repository\Repository
<?php namespace App\Repository; class Repository extends \Nasustop\HapiBase\Repository\Repository { // TODO: 单独建立一个基础类的好处是,如果组件中的方法有不符合自己业务的,可选择重写该方法 }
filter查询
$filter = [ 'name' => 'test', 'age|gte' => 18, ]; $filter = [ 'sex' => '男', [ ['name' => 'test'], 'id' => 1, ['age|lte' => 18], ], ]; $filter = [ 'name' => 'test', 'or' => [ ['age' => 18, 'sex' => '男'], ['age' => 19, 'sex' => '女'], ['age' => 19, 'sex' => '女'], 'name' => 'test01', ], ];