PHP code example of aobozhang / laravel-scout-elastic

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

    

aobozhang / laravel-scout-elastic example snippets


// config/app.php
'providers' => [
    ...
    Laravel\Scout\ScoutServiceProvider::class,
    ...
    ScoutEngines\Elasticsearch\ElasticsearchProvider::class,
],

// config/scout.php
// Set your driver to elasticsearch
    'driver' => env('SCOUT_DRIVER', 'elasticsearch'),

...

'elasticsearch' => [
        'default_index' => env('ELASTICSEARCH_INDEX', 'default'),
        'index_prefix'  => env('ELASTICSEARCH_INDEX_PREFIX', true),
        'hosts' => [
            [
                'host'   => env('ELASTICSEARCH_HOST', 'http://localhost'),
                'port'   => env('ELASTICSEARCH_PORT', '9200'),
                'scheme' => env('ELASTICSEARCH_SSL', true) ? 'https': 'http',
                // 'user'   => 'username',
                // 'pass'   => 'password!#$?*abc'
            ],
        ],
    ],
...