Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 1.06 KB

File metadata and controls

39 lines (24 loc) · 1.06 KB

Step 1: Setting up the library in Silex

A) Download the library

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.0

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

B) Setup the library

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();