Skip to content

superagentvshttpful

MIT 180 16 16,610
41.1 million (month) Aug 22 2011 10.1.1(2024-10-22 17:26:05 ago)
1,803 4 88 MIT
Apr 14 2012 5.5 thousand (month) 1.0.0(2024-05-01 11:33:16 ago)

superagent is an HTTP client library for Node.js that provides a simple, flexible, and powerful API for making HTTP requests. It supports all major HTTP methods, and has a clean and easy-to-use interface for handling responses and errors.

what differentiates superagent from other http clients is its simple declarative API.

Httpful is a simple Http Client library for PHP 7.2+. There is an emphasis of readability, simplicity, and flexibility – basically provide the features and flexibility to get the job done and make those features really easy to use.

Features

  • Readable HTTP Method Support (GET, PUT, POST, DELETE, HEAD, PATCH and OPTIONS)
  • Custom Headers
  • Automatic "Smart" Parsing
  • Automatic Payload Serialization
  • Basic Auth
  • Client Side Certificate Auth
  • Request "Templates"

Highlights


declarativeproxypopular

Example Use


```javascript const superagent = require('superagent'); // superagent supports both Promises and async/await superagent.get('https://httpbin.org/get') .then(res => console.log(res.text)) .catch(err => console.error(err)); const response = superagent.get('https://httpbin.org/get') // post requests: superagent.post('https://httpbin.org/post').send({ name: 'John Doe' }) // setting proxy superagent.get('https://httpbin.org/ip').proxy('http://proxy.example.com:8080') // settings headers and proxies superagent.get('https://httpbin.org/headers').set('Cookie', 'myCookie=123').set('X-My-Header', 'myValue') ```
```javascript require 'vendor/autoload.php'; use Httpful\Request; // make GET request $response = \Httpful\Request::get("http://httpbin.org/get") ->send(); echo $response->body; // make POST request $data = array('name' => 'Bob', 'age' => 35); $response = \Httpful\Request::post("http://httpbin.org/post") ->sendsJson() ->body(json_encode($data)) ->send(); echo $response->body; // add headers or cookies $response = \Httpful\Request::get("http://httpbin.org/headers") ->addHeader("API-KEY", "mykey") ->addHeader("Cookie", "foo=bar") ->send(); echo $response->body; ```

Alternatives / Similar


Was this page helpful?