Sanity service provider for Silex
A service provider for Silex that can be used to communicate with the Sanity API using the PHP library., (*1)

, (*2)
Requirements
The service provider can be used with Silex >= 2.0., (*3)
Installation
You can install the library via Composer. Run the following command:, (*4)
composer require sanity/silex-service-provider
To load the service provider simply register it in the Silex application:, (*5)
<?php
$app = new Silex\Application();
$app->register(new Sanity\Silex\ServiceProvider(), [
'sanity.client.options' => [
'projectId' => '<project id>', // required
'dataset' => '<dataset>', // required
'useCdn' => true,
],
]);
Usage
The service provider exposes the API client through a service called sanity.client
that can be fetched from the application instance:, (*6)
$apiClient = $app['sanity.client'];
Learn more about how to use the PHP library for the Sanity API., (*7)
Contributing
sanity/silex-service-provider
follows the PSR-2 Coding Style Guide. Contributions are welcome, but must conform to this standard., (*8)
License
MIT-licensed, see LICENSE., (*9)