popshack/silex-hal-serviceprovider

A Silex Service Provider for the HAL library

This package's canonical repository appears to be gone and the package has been frozen as a result.

dev-master / 1.0.x-dev 2013-06-11 14:05 UTC

This package is not auto-updated.

Last update: 2021-02-14 21:17:33 UTC


README

A service provider for Silex to improve dependency injection when using the HAL library.

Registering the provider

<?php

use \Silex\Application;
use \Popshack\Silex\Provider\Hal\HalServiceProvider;

$app = new Application();

$app->register(new HalServiceProvider());

You can now use this in your controllers to obtain a Hal instance:

$app->get('/hello', function () use ($app) {
    $hal = $app['hal']('/orders');
    return $hal->asJson();
});

Installation

Installation is using Composer. The preferred method of installation is via packagist as this provides the PSR-0 autoloader functionality. The following composer.json will download and install the latest version of of the provider and dependencies into your project.

{
    "require": {
        "popshack/silex-hal-serviceprovider": "dev-master"
    },
    "minimum-stability": "dev"
}

Alternatively, clone the project and install into your project manually.

License

Popshack\Silex\Provider\Hal is licensed under the MIT license.