PHP code example of directorytree / opensearch-scout-driver

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

    

directorytree / opensearch-scout-driver example snippets


'driver' => env('SCOUT_DRIVER', 'opensearch'),

'default' => env('OPENSEARCH_CONNECTION', 'default'),

'connections' => [
    'default' => [
        'hosts' => [
            env('OPENSEARCH_HOST', 'localhost:9200'),
        ],
    ],
],

'refresh_documents' => env('OPENSEARCH_SCOUT_REFRESH_DOCUMENTS', false),

use App\Models\Post;

$posts = Post::search('laravel')->get();
bash
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
bash
php artisan vendor:publish --provider="DirectoryTree\OpenSearchClient\OpenSearchClientServiceProvider"
bash
php artisan vendor:publish --provider="DirectoryTree\OpenSearchScoutDriver\OpenSearchScoutServiceProvider"