Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require mediamonks/rest-api ~1.0This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
In the Silex micro-framework you can use this library with just a single line of code:
require_once __DIR__ . '/../../vendor/autoload.php';
use MediaMonks\RestApi\EventSubscriber\RestApiEventSubscriberFactory;
$app = new Silex\Application();
$app['dispatcher']->addSubscriber(RestApiEventSubscriberFactory::create());
$app->get('/api', function() {
return 'Hello Api';
});
$app->run();