PHP code example of orzcc / aliyun-opensearch

1. Go to this page and download the library: Download orzcc/aliyun-opensearch 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/ */

    

orzcc / aliyun-opensearch example snippets


use Orzcc\Opensearch\Facades\Opensearch;
// you can alias this in config/app.php if you like

// Add a new app to search
// $opensearch = Opensearch::connection('main');
// $opensearch = Opensearch::connection('app2');
$opensearch = Opensearch::connection();
$opensearch->setFormat('json');
$opensearch->setQueryString('default:阿里云');

$result = $opensearch->search();
bash
$ php artisan vendor:publish