PHP code example of cmsig / seal-yii-module

1. Go to this page and download the library: Download cmsig/seal-yii-module 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/ */

    

cmsig / seal-yii-module example snippets




// config/common/params.php

return [
    // ...
    'cmsig/seal-yii-module' => [
        'schemas' => [
            'app' => [
                'dir' => 'config/schemas',
            ],
        ],
        'engines' => [
            'default' => [
                'adapter' => 'meilisearch://127.0.0.1:7700',
            ],
        ],
        'index_name_prefix' => '',
        'reindex_providers' => [
            \App\Search\BlogReindexProvider::class,
        ],
    ],
];



// config/common/params.php

return [
    // ...
    'cmsig/seal-yii-module' => [
        'schemas' => [
            'app' => [
                'dir' => 'config/schemas/app',
                'engine' => 'meilisearch',
            ],
            'other' => [
                'dir' => 'config/schemas/other',
                'engine' => 'algolia',
            ],
        ],
        'engines' => [
            'algolia' => [
                'adapter' => 'algolia://' . $_ENV['ALGOLIA_APPLICATION_ID'] . ':' . $_ENV['ALGOLIA_ADMIN_API_KEY'],
            ],
            'elasticsearch' => [
                'adapter' => 'elasticsearch://127.0.0.1:9200',
            ],
            'meilisearch' => [
                'adapter' => 'meilisearch://127.0.0.1:7700',
            ],
            'memory' => [
                'adapter' => 'memory://',
            ],
            'opensearch' => [
                'adapter' => 'opensearch://127.0.0.1:9200',
            ],
            'redisearch' => [
                'adapter' => 'redis://[email protected]:6379',
            ],
            'solr' => [
                'adapter' => 'solr://127.0.0.1:8983',
            ],
            'typesense' => [
                'adapter' => 'typesense://[email protected]:8108',
            ],
            
            // ...
            'multi' => [
                'adapter' => 'multi://elasticsearch?adapters[]=opensearch',
            ],
            'read-write' => [
                'adapter' => 'read-write://elasticsearch?write=multi',
            ],
        ],
    ],
];

class Some {
    public function __construct(
        private readonly \CmsIg\Seal\EngineInterface $engine,
    ) {
    }
}

class Some {
    private Engine $engine;

    public function __construct(
        private readonly \CmsIg\Seal\EngineRegistry $engineRegistry,
    ) {
        $this->engine = $this->engineRegistry->getEngine('algolia');
    }
}