PHP code example of nasustop / hapi-mongo

1. Go to this page and download the library: Download nasustop/hapi-mongo 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-mongo example snippets


mongo()->cmd([
    // 集合名
    'createIndexes' => 'api_log',
    'indexes' => [
        [
            // 索引名
            'name' => 'msg_code_index',
            // 索引字段数组[1升序,-1降序]
            'key' => ['msg_code' => 1],
        ],
    ],
]);
shell
php bin/hyperf.php vendor:publish nasustop/hapi-mongo