Download the PHP package ci/restclientbundle without Composer

On this page you can find all versions of the php package ci/restclientbundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package restclientbundle

RestClientBundle

A Smart REST client with an intuitive API, providing all REST methods and returning a Symfony Response Object.

Motivation

There are some Symfony2 bundles providing abstractions for REST requests, but none of them is actually feeling like: "That's what I was looking for!". Having used some of these in the past, we always had to improve or remap their API's for our own needs.

Some days ago we faced the same frustrating challenge again and started to meditate about the idea that our specific API needs really aren't that particular. So we questioned ourselves how a simple REST-Client-API should look like:

Another concern was the leaky abstraction many of the other bundles present to us in respect to the output: They map the PHP-native curl-addon's API to an object-oriented interface only to let us work with the non-object-oriented original output of curl's API calls. At this point it is more convenient to stay with the (extremely inconvenient) PHP internal curl API only.

But how should outputs be wrapped?

So the Symfony Response Object is our choice to go: We don't need to roll out our own implementation and can stay within the boundaries of our framework of choice - win/win :-).

So all in all let's call it a day and start goin' gorillas with this one.

Installation

Step 1: Download the bundle using composer

Add the bundle by running the command:

Composer will install the bundle to your project's directory.

Step 2: Enable the bundle

Enable the bundle in the symfony kernel

Configuration

The bundle allows you to configure all default options that the underlying PHP internal curl library provides - with their real names. No re-re-re-mapping-mapping-re-... :D

The names and their possible values can be found here: http://php.net/manual/de/function.curl-setopt.php

You can change the configuration by adding the following lines to your app/config.yml:

Example:

Sets thre request header to application/json and follows redirects.

Exceptions:

You cannot change the default value for CURLOPT_RETURNTRANSFER (default=true).

Usage

Exception Handling

As the rest client is using libcurl we have created an exception class for each libcurl error. Have a look at the full list of errors here: http://curl.haxx.se/libcurl/c/libcurl-errors.html The exception class representing a libcurl error has the following naming conventions:

Knowing that all these exceptions exist improves exception handling a lot:

If you still want to catch all rest exceptions catch the basic libcurl exception:

Advanced usage

You can add additional options to customize a specific request by adding an option array as key value store.

Testing the bundle

The bundle can be tested via phpunit.

Preconditions

Executing tests

The Tests are executed against a local php server located in the Tests/TestServer folder. Execute the tests via

Roadmap


All versions of restclientbundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
ext-curl Version *
symfony/http-kernel Version >=2.1
symfony/dependency-injection Version >=2.1
symfony/config Version >=2.1
symfony/yaml Version >=2.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ci/restclientbundle contains the following files

Loading the files please wait ....