Package Data | |
---|---|
Maintainer Username: | overburn |
Maintainer Contact: | teodormatis@gmail.com (Teodor Matis) |
Package Create Date: | 2016-05-03 |
Package Last Update: | 2017-12-20 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-09-04 15:01:44 |
Package Statistics | |
---|---|
Total Downloads: | 427 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 1 |
Update your composer.json
file to include this package as a dependency
"overburn/http-request": "~1.0"
Register the HttpRequest service provider by adding it to the providers array in the config/app.php
file.
Overburn\HttpRequest\HttpRequestServiceProvider::class
Alias the HttpRequest facade by adding it to the aliases array in the config/app.php
file.
'aliases' => [
'HttpRequest' => Overburn\HttpRequest\Facades\HttpRequest::class
]
Sends a request , and returns an array of the following form:
[
"response" => "response body given by the server",
"info" => "the results of curl_getinfo() on the current request"
]
Example:
$options = [
"method" => "get",
"url" => "http://www.example.com"
];
HttpRequest::request($options);
The options is an array
$options = [
"method" => "get", //required - get, post, put, patch, delete
"url" => "http://www.example.com", //required
"params" => ["parameter"=>"value", "another" => "newvalue"], // url parameters for the request (optional)
"data" => ["postdata[]"=>"avalue", "postdata[]"=>"anothervalue"], // data for post/put/patch/delete requests (optional, not available on "get")
"files" => ["file" => "./example.pdf"], //an array of files (optional, not available on "get")
]