Download the PHP package asika/http without Composer
On this page you can find all versions of the php package asika/http. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package http
The PSR7 Http Implementation
This package provides PSR7 standard Http message objects, Uri objects, Stream objects and Client request object. (PHP 5.3 Compatible)
Some parts of this package based on phly/http and joomla/http
Project deprecated, please see windwalker/http
Installation via Composer
Add this to the require block in your composer.json
.
Make A Request
HttpClient is a simple class to make restful request.
Other Methods
Use Psr RequestInterface to Make Request
Psr7 Request is a immutable object, you have to get the return object every operation.
Use Uri and Json output.
Custom Transports and Options
Now support Curl and Steam 2 transports.
Set custom CURL options:
Download Remote File
Response Interface
Response object holds a Stream object to store returned string.
Uri
Uri
is a simple Uri object to modify URL but not Psr UriInterface.
The methods provided in the Uri
class allow you to manipulate all aspects of a uri. For example, suppose you wanted to set a new uri, add in a port, and then also post a username and password to authenticate a .htaccess security file. You could use the following syntax:
This will output:
If you wanted to add a specific filepath after the host you could use the setPath()
method:
Which will output
Adding a URL query:
Output:
PsrUri
PsrUri
is a Uri object implemented the Psr UriInterface.
This object is also immutable, so we must get return value as new object every change.
Stream
Stream is a powerful stream wrapper.
Read write data to memory:
Read data from php://input
Read file:
Quick copy stream.
See: Psr7 StreamInterface / API
Other Http Message Objects
ServerRequest
A Request object to store server data, like: $_SERVER
, $_COOKIE
, $_REQUEST
etc.
UploadedFile
An object to store uploaded files, see: Uploaded files interface