Skip to content

EdgarPost/symfony-rest-api-bundle

 
 

Repository files navigation

Build Status Latest Stable Version Total Downloads Latest Unstable Version License SensioLabsInsight

MediaMonksRestApiBundle

This bundle provides tools to implement an API according to the MediaMonks REST API specifications:

  • Converts all responses automatically to the specification
  • Accepts application/json, application/x-www-form-urlencoded & multipart/form-data input
  • Supports json and xml response
  • Supports method overriding
  • Supports forcing a "200 OK" status method
  • Supports paginated responses

Requirements

Installation

Step 1: Download the Bundle

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-bundle "~1.0"

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

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new MediaMonks\RestApiBundle\MediaMonksRestApiBundle(),
        );

        // ...
    }

    // ...
}

Usage

By default the event subscriber will be active on all calls that start with /api, however you can also implement the MediaMonks\RestApiBundle\RestApiControllerInterface on a controller to force the event subscriber to become active.

You can simply return a string, array, object, Symfony response or exception from a controller and it will be automatically converted into a proper output conforming to the MediaMonks Rest API Spec.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 98.5%
  • HTML 1.5%