Download the PHP package utopia-php/fetch without Composer
On this page you can find all versions of the php package utopia-php/fetch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download utopia-php/fetch
More information about utopia-php/fetch
Files in utopia-php/fetch
Download utopia-php/fetch
More information about utopia-php/fetch
Files in utopia-php/fetch
Vendor utopia-php
Package fetch
Short Description A simple library that provides an interface for making HTTP Requests.
License MIT
Package fetch
Short Description A simple library that provides an interface for making HTTP Requests.
License MIT
Please rate this library. Is it a good library?
Informations about the package fetch
Utopia Fetch
Lite & fast micro PHP library that provides a convenient and flexible way to perform HTTP requests in PHP applications.
Usage
Create an instance of the Client
class to perform HTTP requests. The instance methods allow for setting request options like headers, timeout, connection timeout, and more.
The fetch()
method on a Client
instance accepts the following parameters:
url
- A String containing the URL to which the request is sent.method
- A String containing the HTTP method for the request. The default method isGET
.body
- An array of data to send as the body of the request, which can be an associative array for form data or a JSON string.query
- An associative array of query parameters.
The Response
object returned by fetch()
provides several methods to inspect the response:
isOk()
- Checks if the response status code is within the 200-299 range.getBody()
- Retrieves the response body as a string.getHeaders()
- Fetches the response headers as an associative array.getStatusCode()
- Gets the response status code.json()
- Decodes the response body to an associative array.text()
- Alias forgetBody()
, returns the response body as a string.blob()
- Returns the response body as a blob.
Examples
GET Request
POST Request
Sending a file
All versions of fetch with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.0
The package utopia-php/fetch contains the following files
Loading the files please wait ....