Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/palmtreephp/curl
:palm_tree: cURL wrapper to make HTTP requests easier
https://github.com/palmtreephp/curl
composer-package curl php
Last synced: 2 days ago
JSON representation
:palm_tree: cURL wrapper to make HTTP requests easier
- Host: GitHub
- URL: https://github.com/palmtreephp/curl
- Owner: palmtreephp
- License: mit
- Created: 2017-06-18T12:24:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-09T11:42:57.000Z (almost 5 years ago)
- Last Synced: 2024-05-02T22:32:04.072Z (7 months ago)
- Topics: composer-package, curl, php
- Language: PHP
- Homepage:
- Size: 33.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# :palm_tree: Palmtree Curl
[![License](http://img.shields.io/packagist/l/palmtree/curl.svg)](LICENSE)
[![Travis](https://img.shields.io/travis/palmtreephp/curl.svg)](https://travis-ci.org/palmtreephp/curl)
[![Scrutinizer](https://img.shields.io/scrutinizer/g/palmtreephp/curl.svg)](https://scrutinizer-ci.com/g/palmtreephp/curl/)
[![Code Coverage](https://scrutinizer-ci.com/g/palmtreephp/curl/badges/coverage.png)](https://scrutinizer-ci.com/g/palmtreephp/curl/)A PHP cURL wrapper to make HTTP requests easier.
## Requirements
* PHP >= 7.1## Installation
Use composer to add the package to your dependencies:
```bash
composer require palmtree/curl
```## Usage
### Basic Usage
You can use the static `getContents` method if you just want to retrieve a response body from a URL:```php
getResponse();$headers = $response->getHeaders();
$contentType = $response->getHeader('Content-Type');
$body = $response->getBody();
```### Advanced Usage
```php
true,
]);$curl->getRequest()->addHeader('Host', 'example.org');
try {
$response = $curl->execute();
} catch(CurlErrorException $e) {
}$headers = $response->getHeaders();
$body = $response->getBody();if($response->is404()) {
// handle 404 error
}if($response->isOk()) {
// response status code is in the 2xx range
}```
## License
Released under the [MIT license](LICENSE)