2017 © Pedro Peláez
 

library rest-client-bundle

Library to consume REST APIs

image

innmind/rest-client-bundle

Library to consume REST APIs

  • Friday, October 6, 2017
  • by Baptouuuu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 159 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 10 % Grown

The README.md

REST Client Bundle

master develop
Scrutinizer Code Quality Scrutinizer Code Quality
Code Coverage Code Coverage
Build Status Build Status

Installation

composer require innmind/rest-client-bundle

Enable the bundle by adding the following line in your app/AppKernel.php of your project:, (*1)

// app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Innmind\Rest\ClientBundle\InnmindRestClientBundle,
        );
        // ...
    }
    // ...
}

Then you need to specify the types you allow in the app, here's an example:, (*2)

innmind_rest_client:
    content_type:
        json:
            priority: 0
            media_types:
                application/json: 0

Usage

$container
    ->get('innmind_rest_client')
    ->server('http://example.com/')
    ->capabilities()
    ->names();

This example would return all the resource available through the api of http://example.com/., (*3)

Then you can access the following method on any server: all, read, create, update and remove. Check the interface to understand how to use these methods., (*4)

The Versions