sanity / silex-service-provider
Sanity service provider for Silex
Requires
- sanity/sanity-php: ^1.0
Requires (Dev)
- phpunit/phpunit: ^5.7
- silex/silex: ^2.0
- squizlabs/php_codesniffer: ^2.8
This package is not auto-updated.
Last update: 2023-04-15 21:35:01 UTC
README
A service provider for Silex that can be used to communicate with the Sanity API using the PHP library.
Requirements
The service provider can be used with Silex >= 2.0.
Installation
You can install the library via Composer. Run the following command:
composer require sanity/silex-service-provider
To load the service provider simply register it in the Silex application:
<?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:
$apiClient = $app['sanity.client'];
Learn more about how to use the PHP library for the Sanity API.
Contributing
sanity/silex-service-provider
follows the PSR-2 Coding Style Guide. Contributions are welcome, but must conform to this standard.
License
MIT-licensed, see LICENSE.