Download the PHP package chaplean/rest-client-bundle without Composer
On this page you can find all versions of the php package chaplean/rest-client-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chaplean/rest-client-bundle
More information about chaplean/rest-client-bundle
Files in chaplean/rest-client-bundle
Package rest-client-bundle
Short Description Create a Restful API Client quickly
License MIT
Informations about the package rest-client-bundle
Chaplean Rest-Client-Bundle
Prerequisites
This version of the bundle requires Symfony 2.8+.
Installation
1. Composer
2. AppKernel.php
Add
3. config.yml and parameters.yml
First you will need to configure guzzlehttp that we use under the hood to perform the actual http requests. See the bundle documentation or the library documentation for full range of options. Example:
config.yml
You will probably also want to create some custom parameters.
parameters.yml
As you inject guzzle in your Api class you can have different configuration per Api. See next section.
Next this bunde expose some configuration if you want to enable extra features. You can enable database and / or email logging of requests. To use the database or email loggers you will have to setup respectively doctrine or swiftmailer in your project. The default configuraton is:
config.yml
You can override the default email content by overriding the translation keys or even the email body twig template.
The translation keys are under chaplean_rest_client.email.request_executed_notification
and the template is Resources/views/Email/request_executed_notification.txt.twig
.
Usage
Creating Api class
To use rest-client-bundle you have to create a class extending AbstractApi. You can create any number of classes extending AbstractApi and have all of them using different configurations via dependency injection.
And we're done! We could repeat this process to create another Api with completely different configurations.
Defining Api
Let's focus on the function you have to fill in and what we can do in it. The role of this function is to define your Api using rest-client-bundle api:
All versions of rest-client-bundle with dependencies
eightpoints/guzzle-bundle Version ^5.3 || ^6.0 || ^7.0
symfony/config Version ^3.0 || ^4.0
symfony/console Version ^3.0 || ^4.0
symfony/dependency-injection Version ^3.0 || ^4.0
symfony/yaml Version ^3.0 || ^4.0