Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 1.37 KB

File metadata and controls

37 lines (23 loc) · 1.37 KB

The Transport

The Transport is an implementation of TransportInterface, it manages the API Autentication, returns deserialized data, and manage HTTP errors with ApiException and childs (see src/Exceptions).

Use an existing transport

Several implementations already exist (see the folder) :

Create a custom transport

You are likely to have to manage complex authentication, in this case your can create you own implementation of TransportInterface.

See more about the TransportInterface here.

Example of usage :

<?php

use Cristal\ApiWrapper\Transports\Basic;
use Curl\Curl;

$transport = new Basic('username', 'password', 'http://api.example.com/v1/', new Curl);
$users = $transport->request('/users');

Next

Now that you've got transport, you're ready to implement your Wrapper.

Learn more about Wrapper.