Download the PHP package half2me/curlx without Composer
On this page you can find all versions of the php package half2me/curlx. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download half2me/curlx
More information about half2me/curlx
Files in half2me/curlx
Informations about the package curlx
CurlX
Curl X is a fork of RollingCurlX. At fist I only created this fork to make it installable via composer for a project I was working on.
Now it is a modern, easy-to-use, awesome wrapper for cUrl Multi Handler. With Agents and Requests, take a look at how easy everything has become.
License
MIT
Requirements
PHP 5.6+
Installing
Installing is easy with composer. Just do
composer require half2me/curlx:^1.0
How to Use
First we initialize an agent with the maximum number of concurrent requests we want open at a time. All requests after this will be queued until one completes.
Next we create/add a request to the queue
Most of the values that can be set on individual Requests can also be set for an agent When an agent has these values set, any requests created by that agent, will have these parameters set; If we have many requests using similar headers, urls, or timeout values, we can set these once in the Agent, and use them in all of the requests. For example:
Once we have our agent loaded up with requests
We can start executing them with:
As a request finishes, it will fire an event which we need to hook onto, before we start the agent. For this we need to register one or more callback functions with either the agent (to use the same for all requests) or we can register a separate callback function for each request.
Issues
If you find any issues please let me know. Submit an issue or PR on github
Enjoy.