Download the PHP package joshuaify/guzzlelib without Composer
On this page you can find all versions of the php package joshuaify/guzzlelib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joshuaify/guzzlelib
More information about joshuaify/guzzlelib
Files in joshuaify/guzzlelib
Package guzzlelib
Short Description A wrapper library for Guzzle HTTP client
License MIT
Homepage https://docs.pypapi.ng/guzzlelib/
Informations about the package guzzlelib
Guzzlelib
Guzzlelib is a PHP wrapper library for Guzzle HTTP client, providing a simplified interface for making HTTP requests. It offers an easy-to-use API for GET, POST, PUT, PATCH, and DELETE requests, with built-in error handling and response parsing.
This library can be used with PHP 7.2+ and is compatible with popular PHP frameworks, including Laravel, Symfony, CodeIgniter, Zend, Yii, CakePHP, and Slim. It's ideal for any PHP application that requires streamlined API communication.
Requirements
- PHP 7.2 or higher
- Composer (for dependency management)
- Guzzle HTTP client
Installation
You can install Guzzlelib using Composer. Run the following command in your project directory:
Usage
Initialization
First, include the Guzzlelib class in your PHP file:
or
Then, create an instance of Guzzlelib:
Making Requests
GET Request
POST Request
PUT Request
PATCH Request
DELETE Request
Handling Responses
All request methods return an array with two keys: code
and body
.
code
: The HTTP status code of the response.body
: The decoded JSON body of the response.
Example:
Error Handling
If a request fails, Guzzlelib will return an array with an error
key set to true
and a message
describing the error.
Configuration Options
When initializing Guzzlelib, you can pass an array of configuration options:
base_uri
: The base URL for all requests.timeout
: The timeout for requests in seconds.headers
: An array of default headers to be sent with each request.auth
: Authentication method (e.g., ['username', 'password'] for Basic Auth).proxy
: Proxy settings.verify
: SSL certificate verification (set tofalse
to disable).connect_timeout
: The number of seconds to wait while trying to connect to a server.cookies
: Set totrue
to use a shared cookie session, or provide an instance ofGuzzleHttp\Cookie\CookieJarInterface
.allow_redirects
: Set tofalse
to disable redirects.debug
: Set totrue
to enable debug output.http_errors
: Set tofalse
to disable throwing exceptions on HTTP protocol errors (4xx and 5xx responses).
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This library is open-sourced software licensed under the MIT license.