PHP code example of schranz-search / seal-typesense-adapter

1. Go to this page and download the library: Download schranz-search/seal-typesense-adapter 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/ */

    

schranz-search / seal-typesense-adapter example snippets




use Http\Client\Curl\Client as CurlClient;
use Http\Discovery\Psr17FactoryDiscovery;
use Schranz\Search\SEAL\Adapter\Typesense\TypesenseAdapter;
use Schranz\Search\SEAL\Engine;
use Typesense\Client;

$client = new Client(
    [
        'api_key' => 'S3CR3T',
        'nodes' => [
            [
                'host' => '127.0.0.1',
                'port' => '8108',
                'protocol' => 'http',
            ],
        ],
        'client' => new CurlClient(Psr17FactoryDiscovery::findResponseFactory(), Psr17FactoryDiscovery::findStreamFactory()),
    ]
);

$engine = new Engine(
    new TypesenseAdapter($client),
    $schema,
);