PHP code example of qmrp / laravel-opensearch

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

    

qmrp / laravel-opensearch example snippets


use Qmrp\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