sanity/silex-service-provider

This package is abandoned and no longer maintained. No replacement package was suggested.

Sanity service provider for Silex

v1.0.1 2017-11-20 20:33 UTC

README

A service provider for Silex that can be used to communicate with the Sanity API using the PHP library.

PackagistTravis

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.