PHPackages                             minicli/curly - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. minicli/curly

ActiveLibrary[HTTP &amp; Networking](/categories/http)

minicli/curly
=============

Simple Curl Client

0.2.2(3y ago)14263.0k↑100%2[1 PRs](https://github.com/minicli/curly/pulls)5MITPHPCI passing

Since Feb 24Pushed 4d ago1 watchersCompare

[ Source](https://github.com/minicli/curly)[ Packagist](https://packagist.org/packages/minicli/curly)[ Docs](https://github.com/erikaheidi/minicli)[ RSS](/packages/minicli-curly/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (5)Dependencies (2)Versions (9)Used By (5)

curly
=====

[](#curly)

A tiny experimental curl client built for Minicli (but can be also used standalone).

Requirements
------------

[](#requirements)

Requires `curl` and `php-curl`.

Installation
------------

[](#installation)

To include Curly in your app, first require the dependency with Composer:

```
composer require minicli/curly
```

Usage
-----

[](#usage)

Use the `Minicli/Curl/Client` class to make GET and POST requests using the `get()` and `post()` methods, respectively.

This example queries the DEV API and gets the latest posts from a user:

```
$crawler = new Client();

$articles_response = $crawler->get('https://dev.to/api/articles?username=erikaheidi');

if ($articles_response['code'] !== 200) {
    $app->getPrinter->error('Error while contacting the dev.to API.');
    return 1;
}

$articles = json_decode($articles_response['body'], true);
print_r($articles);
```

The following single-command Minicli application will fetch a user's latest stats from DEV.to using Curly (this requires `minicli/minicli`):

```
#!/usr/bin/env php
