<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
silverstripe / silverstripe-search-client-php example snippets
$plugins = [
new AddHostPlugin(Psr17FactoryDiscovery::findUriFactory()->createUri('https://9595b293cf40d7532796c4ca67a27b81-bifrost.silverstripe.io')),
new AddPathPlugin(Psr17FactoryDiscovery::findUriFactory()->createUri('/api/v1')),
new HeaderAppendPlugin([
'Authorization' => 'Bearer ABC.123.456',
]),
];
// When no HTTP Client is provided, PSR-18 discovery will be used, and your plugins will be attached to the HTTP Client
return Client::create(httpClient: null, additionalPlugins: $plugins);
$httpClient = new GuzzleHttp\Client();
$plugins = [
new AddHostPlugin(Psr17FactoryDiscovery::findUriFactory()->createUri('https://9595b293cf40d7532796c4ca67a27b81-bifrost.silverstripe.io')),
new AddPathPlugin(Psr17FactoryDiscovery::findUriFactory()->createUri('/api/v1')),
new HeaderAppendPlugin([
'Authorization' => 'Bearer ABC.123.456',
]),
];
// Apply the plugins to the HTTP Client
$httpClient = new PluginClient($httpClient, $plugins);
// When an explicit HTTP Client is provided, it will be used
return Client::create($httpClient);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.