PHP code example of cmsig / seal-mezzio-module

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




// src/App/src/ConfigProvider.php

class ConfigProvider
{
    public function __invoke(): array
    {
        return [
            // ...
            'cmsig_seal' => [
                'schemas' => [
                    'app' => [
                        'dir' => 'config/schemas',
                    ],
                ],
                'engines' => [
                    'default' => [
                        'adapter' => 'meilisearch://127.0.0.1:7700',
                    ],
                ],
            ],
        ];
    }
}



// src/App/src/ConfigProvider.php

class ConfigProvider
{
    public function __invoke(): array
    {
        return [
            // ...
            'cmsig_seal' => [
                'schemas' => [
                    'app' => [
                        'dir' => 'config/schemas/app',
                        'engine' => 'meilisearch',
                    ],
                    'other' => [
                        'dir' => 'config/schemas/other',
                        'engine' => 'algolia',
                    ],
                ],
                'engines' => [
                    'algolia' => [
                        'adapter' => 'algolia://%ALGOLIA_APPLICATION_ID%%:%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',
                    ],
                ],
                'index_name_prefix' => '',
                'reindex_providers' => [
                    \App\Search\BlogReindexProvider::class,
                ],
            ],
        ];
    }
}

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');
    }
}