Download the PHP package dvanderburg/silex-batched-request without Composer

On this page you can find all versions of the php package dvanderburg/silex-batched-request. 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 silex-batched-request

Silex Batched Request Service Provider

Latest Stable Version Total Downloads Latest Unstable Version License

Silex service provider to perform batched requests. Usage and implementation roughly based on making batch requests with Facebook's Graph API.

Batching requests allows you to send multiple requests at once, allowing you to perform multiple operations in a single HTTP request. Each request in the batch is processed in sequence unless dependencies are specified.

Requests within the batch can list dependancies on other requests within the batch, and access their responses via JSONP syntax. Again, similar to Facebook's Graph API. Using JSONP syntax, a one request in the batch can use the response from another request in the batch. Once all requests have been completed, an array of responses will be returned and the HTTP connection closed.

Specifying dependancies allows a one request in the batch to utilize the response from another request in the batch. This is achieved using JSONP syntax. More information is provided in the Usage and Examples section.

Built and tested on PHP 5.6, compatible with Silex version 2.

Dependancies

Installation and Setup

Install the package via composer.

Register the service provider as part of your application bootstrap process.

Service Provider Configuration

The service provider can be configured to determine which URL to process batched requests with. The default is /batch/, meaning to send a batched request you would POST to something like http://localhost/batch/. This can be customized, including set the the web root by specifying / for batchrequest.url.

Simple Batched Requests

Send a basic batched request by sending an HTTP post to the url you configured the service provider with (/batch/ by default). This example will perform two GET requests and a POST, returning an array of responses. If sending in form data via the body parameter you will need to specify the content type(application/x-www-form-urlencoded or application/json).

HTTP POST Example:

JQuery XHR Example:

For the examples above, the expected response format would be:

Removing Headers from the Response

Headers can be removed from the response by setting include_headers to false in the data of the batch HTTP request. If not specified, the default behaviour is to return headers with each response.

Errors

If a specific request in the batch fails its response within the array of responses will contain a non-200 code. However, the actual HTTP request to process the batch will still return a 200-OK.

Specifying Dependencies with JSONP

Sometimes an operation of one request in the batch is dependant on the response of another. This dependancy can be created specifying a name for a request and then accessing the response of that request using JSONP syntax.

The following example retrieves a user's collection of books which are represented with a book_id. The book IDs are then used by a second request in the batch to retrieve information about those books.

HTTP POST Example:

In the example above, the first request in the batch is named get-user-books and the second request in the batch uses JSONP syntax to extract all the book_ids from the first request in order to know what books to retrieve.

If a request is a dependancy of another request and fails, it will cause the request which is dependant on it to also fail. In the above example if the get-user-books request fails, the request to retrieve books will also fail.

Limitations

Batched requests are processed after firewall security, meaning you cannot protect individual requests with firewall rules. It is recommended that batched requests are all behind a firewall requiring authentication, or each individual request checks user authentication and permissions.


All versions of silex-batched-request with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
silex/silex Version ~2.0
flow/jsonpath Version ~0.3.4
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 dvanderburg/silex-batched-request contains the following files

Loading the files please wait ....