Download the PHP package pretorien/request without Composer
On this page you can find all versions of the php package pretorien/request. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package request
Request bundle
This repository contains Request bundle which helps you to send requests in a public way or behind a proxy. Several commands allow you to fetching and checking proxies.
This bundle based on Symfony HttpClient Component
Installation
Installation using composer :
Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php
file of your project:
It's necessary to create a Proxy entity extending the bundle one.
Finally, you must update your database :
Configuration
Usage
This bundle provides several commands under the pretorien:proxy: namespace. List them all executing this command:
Fetching Proxies
First of all, you must initialize the proxy list with the pretorien:proxy:fetch
command.
This is based on fetchers allowing to retrieve data from provides. Currently there is only one : NordVPN.
You must therefore configure your cretendials as indicated above.
This command has several options :
Checking Latency
The pretorien:proxy:check
command checks existing proxies health and checks if these are anonymous.
Making Requests
RequestService contains all the methods allowing to sending private or public requests. You can use this service directly in your controllers via Autowiring :
Sending public and private Requests
RequestService provides a single request() method to perform all kinds of HTTP requests. All private requests are automatically configured with a proxy.
Two aliases make it easier to send requests
These methods return an ResponseInterface object. Responses are always asynchronous, so that the call to the method returns immediately instead of waiting to receive the response:
Sending concurrent Requests
Many requests can be sent simultaneously thanks to PoolRequest. RequestService provides a single createPoolRequest() method to create a new PoolRequest object having an addRequest method. This allows you to add requests (private or public) to the pool.
Finally, the sendPoolRequest method will allow you to send this pool.
Creating Pool Request
Processing Responses
The response returned by sendPoolRequest method is an object of type PoolResponse which is iterable and provide ResponseInterface object.
License and contributors
Published under the MIT, read the LICENSE file for more information.
All versions of request with dependencies
symfony/dom-crawler Version ^5.0
symfony/http-client Version ^5.0
symfony/options-resolver Version ^5.0
symfony/config Version ^5.0
symfony/orm-pack Version ^1.0
symfony/browser-kit Version ^5.0
nyholm/psr7 Version ^1.2