1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-01-17 21:38:16 +01:00
guzzle/README.md

75 lines
2.3 KiB
Markdown
Raw Normal View History

2011-11-13 19:28:24 -06:00
Guzzle, PHP HTTP client and webservice framework
Guzzle 2.0 Adopting composer for dependency management Updating LICENSE, travis build file, making better use of git ignores, and remove unused build target Removing @author tags. Use the commit history for a changelog. Moving files from build folder to / Adding min build target to product a Guzzle only phar with no autoloader [Common] Accepting ZF1 or ZF2 cache in ZendCacheAdapter [Common] Optimizing Stream wrapper and EntityBody abstractions. [Common] [Http] Migrating from Guzzle event system to the Symfony2 event dispatcher [Common] Moved Inflector and Inspector to Service namespace [Http] Simplifying Guzzle\Guzzle curl detection [Http] Removing Guzzle\Http\Pool and now using Guzzle\Http\Curl\CurlMulti [Http] The helper methods from Guzzle\Http\Message\RequestFactory have been removed to prevent confusion and encourage developers to use Guzzle\Http\Client to create requests. [Http] Clients can now send one or more requests in an array using the send() method, so the batch() method was removed. [Http] Updating curl multi to allow blocking calls while sending other transfers [Http] Making the Request::hasHeader method more intuitive. Guzzle\Http\Message\AbstractMessage::hasHeader() now returns true if the header is found using exact matching. If the header is found using a regex or case-insensitive match, then it will return the name of the found header. [Http] Removing content-type guessing from EntityBody based on file extension and solely using finfo. [Http] Adding basic auth plugin [Http] Cleaning up CookieJar and CurlMulti [Http] Removing custom rawurlencode from QueryString because PHP 5.3 now properly deals with tilde characters. [Http] Minor optimization to parsing messages in RequestFactory [Http] Adding Guzzle\Http\Client for developers that don't need commands or service descriptions [Http] Making it easier to set a global User-Agent header for a Guzzle\Http\Client [Http] Fixing the discrepancies between the ClientInterface and Guzzle\Http\Client [Http] Adding the ability to set and retrieve tokenized headers from Requests and Responses [Service] Ditching NIH filters and using the Symfony2 validator [Service] Moving most service building logic to the ServiceBuilder::factory method so that it is easier to build custom config readers. [Service] Allowing deep nested command inheritance. [Service] Cleaning up Inflector caching. [Service] Getting rid of concept of can_batch because everything is now sent in parallel. [Service] Adding a JSON description builder. [Service] Cleaning up ResourceIteratorApplyBatched. [Service] Removing caching stuff from ServiceBuilder because the data being cached is extremely fast to generate. [Service] Added a method to serialize the ServiceDescription in case a ServiceDescription needs to be cached in an application. [Service] Making description builders use static methods. [Service] Adding support to include other description files for XML and JSON description builders. [Service] Adding support for filters to ApiCommands [Service] Using {{}} instead of $. to reference other services as a dependency for another service
2012-01-14 13:57:05 -06:00
================================================
2011-11-11 17:21:41 -06:00
2014-03-02 10:45:13 -08:00
[![Build Status](https://secure.travis-ci.org/guzzle/guzzle.png?branch=master)](http://travis-ci.org/guzzle/guzzle)
2013-06-10 13:47:53 -07:00
2014-10-08 18:35:23 -07:00
Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and super
simple to integrate with web services.
- Manages things like persistent connections, represents query strings as
collections, simplifies sending streaming POST requests with fields and
files, and abstracts away the underlying HTTP transport layer.
- Can send both synchronous and asynchronous requests using the same interface
without requiring a dependency on an event loop.
- Pluggable HTTP adapters allows Guzzle to integrate with any method you choose
for sending HTTP requests over the wire (e.g., cURL, sockets, PHP's stream
2014-10-08 22:49:03 -07:00
wrapper, non-blocking event loops like ReactPHP.
2014-10-08 18:35:23 -07:00
- Guzzle makes it so that you no longer need to fool around with cURL options,
stream contexts, or sockets.
2013-06-03 23:12:35 -07:00
```php
2014-03-02 10:45:13 -08:00
$client = new GuzzleHttp\Client();
$response = $client->get('http://guzzlephp.org');
$res = $client->get('https://api.github.com/user', ['auth' => ['user', 'pass']]);
2014-03-18 10:27:47 -07:00
echo $res->getStatusCode();
// "200"
2014-03-02 10:45:13 -08:00
echo $res->getHeader('content-type');
// 'application/json; charset=utf8'
echo $res->getBody();
// {"type":"User"...'
var_export($res->json());
// Outputs the JSON decoded data
2014-10-08 18:35:23 -07:00
// Send an asynchronous request.
$req = $client->createRequest('GET', 'http://httpbin.org', ['future' => true]);
$client->send($req)->then(function ($response) {
echo 'I completed! ' . $response;
});
2013-06-03 23:12:35 -07:00
```
2011-11-13 19:28:24 -06:00
2014-03-02 10:45:13 -08:00
Get more information and answers with the
[Documentation](http://guzzlephp.org/),
[Forums](https://groups.google.com/forum/?hl=en#!forum/guzzle),
2014-10-08 22:49:03 -07:00
and [Gitter](https://gitter.im/guzzle/guzzle).
2014-03-02 10:45:13 -08:00
2012-06-17 17:59:53 -07:00
### Installing via Composer
2014-03-02 10:45:13 -08:00
The recommended way to install Guzzle is through
[Composer](http://getcomposer.org).
2012-06-17 17:59:53 -07:00
2013-06-03 23:12:35 -07:00
```bash
# Install Composer
curl -sS https://getcomposer.org/installer | php
2014-03-15 16:46:57 -07:00
```
Next, update your project's composer.json file to include Guzzle:
2012-06-17 17:59:53 -07:00
2014-03-15 16:46:57 -07:00
```javascript
{
2014-03-15 16:49:17 -07:00
"require": {
2014-10-08 18:35:23 -07:00
"guzzlehttp/guzzle": "~5.0"
2014-03-15 16:46:57 -07:00
}
}
2013-06-03 23:12:35 -07:00
```
2013-06-03 23:12:35 -07:00
After installing, you need to require Composer's autoloader:
2013-06-03 23:12:35 -07:00
```php
require 'vendor/autoload.php';
```
2014-03-02 10:45:13 -08:00
### Documentation
2013-06-30 11:21:03 +01:00
2014-03-02 10:45:13 -08:00
More information can be found in the online documentation at
http://guzzlephp.org/.