Overview

Namespaces

  • ApiBundle
    • DataFixtures
      • Faker
        • Provider
    • DependencyInjection
    • Doctrine
      • DBAL
        • Type
      • ORM
        • Filter
          • User
    • Entity
    • EventListener
      • Doctrine
    • Manager
    • Utils
  • FrontBundle
    • Bundle
      • UserBundle
    • Client
      • Exception
    • Controller
    • DependencyInjection
    • Form
      • DataTransformer
      • Type
    • Menu
    • Security
      • Http
        • Authentication
    • Services
      • Http
    • Twig
    • Utils

Classes

  • ApiClient

Interfaces

  • ClientInterface
  • Overview
  • Namespace
  • Class

Interface ClientInterface

Direct known implementers

FrontBundle\Client\ApiClient
Namespace: FrontBundle\Client
Author: Théo FIDRY theo.fidry@gmail.com
Located at FrontBundle/Client/ClientInterface.php
Methods summary
public Psr\Http\Message\RequestInterface
# createRequest( string $method, string|null $url = null, string|null $token = null, array $options = [] )

Creates and return a new Request object. All get, head, etc. methods are generated via this method.

Creates and return a new Request object. All get, head, etc. methods are generated via this method.

Parameters

$method
HTTP method.
$url
URL, URL, URI or route name.
$token
API token.
$options

Array of request options to apply. can have the keys: - headers: array - parameters (route parameters if $url is a route and not an URI) - body: string|null

Returns

Psr\Http\Message\RequestInterface

Example

If URL is empty, only the base URL will be used: ::createRequest('GET') => http://localhost

If URI is used, add the base URL to generate the proper URL to request ::createRequest('GET', '/api/users') => http://localhost/api/users

If route name is used, will first generate the URI before applying the base URL; can use parameters ::createRequest('GET', 'users_cget') => http://localhost/api/users

::createRequest('GET', 'users_get', null, ['parameters' => ['id' => 14]]) => http://localhost/api/users/14

Can also apply other options ::createRequest('GET', null, null, ['query' => ['id' => 14, 'filter' => ['order' => ['startAt' => 'desc']]]) => http://localhost/api?id=14&filter[where][name]=john

Or if you have just one query ::createRequest('GET', null, null, ['query' => 'filter[where][name]=john') => http://localhost/api?filter[where][name]=john


public Psr\Http\Message\ResponseInterface
# request( string $method, string|null $url = null, string|null $token = null, array $options = [] )

Sends a request.

Sends a request.

Parameters

$method
HTTP method
$url
URL, URI or route name.
$token
API token.
$options
Options applied to the request.

Returns

Psr\Http\Message\ResponseInterface

Throws

FrontBundle\Client\Exception\ClientException
public Psr\Http\Message\ResponseInterface
# send( Psr\Http\Message\RequestInterface $request )

Sends a single request.

Sends a single request.

Parameters

$request
Request to send

Returns

Psr\Http\Message\ResponseInterface

Throws

FrontBundle\Client\Exception\ClientException
API documentation generated by ApiGen