PHP code example of nasustop / hapi-base

1. Go to this page and download the library: Download nasustop/hapi-base library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nasustop / hapi-base example snippets




namespace App\Repository;

class Repository extends \Nasustop\HapiBase\Repository\Repository
{
    // TODO: 单独建立一个基础类的好处是,如果组件中的方法有不符合自己业务的,可选择重写该方法
}

$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',
    ],
];