Download the PHP package adrii/curl-helper without Composer
On this page you can find all versions of the php package adrii/curl-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adrii/curl-helper
More information about adrii/curl-helper
Files in adrii/curl-helper
Package curl-helper
Short Description CurlHelper is a streamlined PHP utility for easy cURL usage, supporting GET, POST, PUT, and DELETE methods. It simplifies HTTP requests by offering straightforward options and header settings, making web API interactions more accessible and efficient.
License MIT
Homepage https://github.com/AdrianVillamayor/CurlHelper
Rated 5.00 based on 1 reviews
Informations about the package curl-helper
CurlHelper
Original author: Adrii
CurlHelper
is a streamlined PHP utility for easy cURL usage, supporting GET, POST, PUT, and DELETE methods. It simplifies HTTP requests by offering straightforward options and header settings, making web API interactions more accessible and efficient.
Features
- Versatile HTTP Support: GET, POST, PUT, and DELETE methods are all supported, catering to a wide range of API interactions.
- Header & Option Customization: Effortlessly configure request headers and cURL options to meet the precise needs of every API call.
- File Uploads: Simplified multipart/form-data handling makes file uploads a breeze.
- Data Flexibility: Easily switch between raw and array data inputs, with automatic content type handling for JSON and form-urlencoded data.
- Debug Mode: Activate detailed logging for troubleshooting and optimization, gaining insight into request and response cycles.
Requirements
- PHP 7.4 or higher
- cURL extension enabled in PHP
Installation
You can copy the CurlHelper
class into your project, or preferably, autoload it using Composer.
Composer
Manual
Usage
Methods
This section provides a quick start for users to understand how to apply the CurlHelper
class in their projects for various HTTP requests, setting custom headers, and enabling debug mode for detailed request and response insights.
GET Request
POST Request
PUT Request
DELETE Request
Setting Custom Headers
Enabling Debug Mode
Handling Errors
The execute
method throws an exception if the cURL request fails. Make sure to catch these exceptions and handle them accordingly.
Example
These examples cover basic usage scenarios for CurlHelper. Modify parameters and URLs as needed to fit your specific use case.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
CurlHelper is open-sourced software licensed under the MIT
All versions of curl-helper with dependencies
ext-curl Version *