Skip to content

Commit

Permalink
Guzzle 2.0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mtdowling committed Jan 14, 2012
1 parent 85dae7d commit 4c46e77
Show file tree
Hide file tree
Showing 236 changed files with 6,036 additions and 19,697 deletions.
22 changes: 16 additions & 6 deletions .gitignore
@@ -1,10 +1,20 @@
# Ingore common cruft
.DS_STORE
coverage

# Ignore binary files
guzzle.phar

# Ignore potentially sensitive phpunit file
phpunit.xml
build/guzzle.phar
build/guzzle-na.phar
src/Guzzle/Aws/
src/Guzzle/CardinalCommerce/
src/Guzzle/Unfuddle/

# Helps to ignore services being tested
src/Guzzle/
!src/Guzzle/Guzzle.php
!src/Guzzle/Common
!src/Guzzle/Http
!src/Guzzle/Service

# Ignore composer generated files
composer.lock
vendor/.composer
vendor/
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

8 changes: 3 additions & 5 deletions .travis.yml
Expand Up @@ -3,10 +3,8 @@ php:
- 5.3
- 5.4
before_script:
- git submodule update --init
- wget --quiet http://getcomposer.org/composer.phar
- php composer.phar install --install-suggests
- cp phpunit.xml.dist phpunit.xml
- ~/.nvm/v0.6.1/bin/node tests/Guzzle/Tests/Http/server.js &
- ~/.nvm/nvm.sh run default tests/Guzzle/Tests/Http/server.js &
script: sudo phpunit
notifications:
email:
- michael@guzzlephp.org
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2011 Michael Dowling <michael@guzzlephp.org>
Copyright (c) 2011 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
34 changes: 23 additions & 11 deletions README.md
@@ -1,7 +1,7 @@
Guzzle, PHP HTTP client and webservice framework
===============================================
================================================

Guzzle is a game changer in the world of PHP HTTP clients. Guzzle allows you to truly reap the benefits of the HTTP/1.1 spec. No other library provides persistent connection management or makes it easier to send requests in parallel.</p>
Guzzle is a game changer in the world of PHP HTTP clients. Guzzle allows you to truly reap the benefits of the HTTP/1.1 spec. No other library makes it easier to manage persistent connections or send requests in parallel.</p>

In addition to taking the pain out of HTTP, Guzzle provides a lightweight framework for creating web service clients. Most web service clients follow a specific pattern: create a client class, create methods for each action, create and execute a cURL handle, parse the response, implement error handling, and return the result. Guzzle takes the redundancy out of this process and gives you the tools you need to quickly build a web service client.

Expand Down Expand Up @@ -37,7 +37,7 @@ HTTP basics
```php
<?php

use Guzzle\Service\Client;
use Guzzle\Http\Client;

$client = new Client('http://www.example.com/api/v1/key/{{key}}', array(
'key' => '***'
Expand Down Expand Up @@ -102,18 +102,30 @@ Send requests in parallel
```php
<?php

use Guzzle\Service\Client;

try {
$responses = $client->batch(array(
$client->get('http://www.google.com/'),
$client->head('http://www.google.com/'),
$client->get('https://www.github.com/')
$client = new Guzzle\Http\Client('http://www.myapi.com/api/v1');
$responses = $client->send(array(
$client->get('users'),
$client->head('messages/123'),
$client->delete('orders/123')
));
} catch (PoolRequestException $e) {
} catch (Guzzle\Common\ExceptionCollection $e) {
echo "The following requests encountered an exception: \n";
foreach ($e as $exception) {
echo $exception->getRequest() . "\n" . $exception->getMessage() . "\n";
}
}
```
```

Testing Guzzle
--------------

Here's how to install Guzzle from source to run the unit tests:

```
git clone git@github.com:guzzle/guzzle.git
cd guzzle
composer.phar install --install-suggests
cp phpunit.xml.dist phpunit.xml
phpunit
```
24 changes: 24 additions & 0 deletions autoload.php
@@ -0,0 +1,24 @@
<?php

$namespaces = array(
'Guzzle' => 'phar://' . __FILE__ . '/src',
'Symfony\\Component\\Validator' => 'phar://' . __FILE__ . '/vendor/symfony/validator',
'Symfony\\Component\\EventDispatcher' => 'phar://' . __FILE__ . '/vendor/symfony/event-dispatcher',
'Doctrine' => 'phar://' . __FILE__ . '/vendor/doctrine/common/lib',
'Monolog' => 'phar://' . __FILE__ . '/vendor/monolog/monolog/src'
);

if (DIRECTORY_SEPARATOR == '/') {
require_once 'phar://' . __FILE__ . '/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php';
} else {
require_once 'phar://' . __FILE__ . '\\vendor\\symfony\\class-loader\\Symfony\\Component\\ClassLoader\\UniversalClassLoader.php';
$namespaces = array_filter($namespaces, function($namespace) {
return str_replace('phar:\\\\', 'phar://', str_replace('/', '\\', $namespace));
});
}

$classLoader = new Symfony\Component\ClassLoader\UniversalClassLoader();
$classLoader->registerNamespaces($namespaces);
$classLoader->register();

__HALT_COMPILER();
42 changes: 42 additions & 0 deletions build.xml
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="guzzle" default="phar">
<target name="phar" description="Create a phar with an autoloader">
<if>
<equals arg1="${min}" arg2="true" />
<then>
<pharpackage
destfile="./guzzle-min.phar"
basedir="."
alias="Guzzle"
signature="md5">
<fileset dir=".">
<include name="src/**/*.php" />
</fileset>
<metadata>
<element name="version" value="2.0.0" />
</metadata>
</pharpackage>
</then>
<else>
<pharpackage
destfile="./guzzle.phar"
basedir="."
stub="autoload.php"
alias="Guzzle"
signature="md5">
<fileset dir=".">
<include name="src/**/*.php" />
<include name="vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php" />
<include name="vendor/symfony/event-dispatcher/**/*.php" />
<include name="vendor/symfony/validator/**/*.php" />
<include name="vendor/doctrine/common/lib/Doctrine/Common/Cache/*.php" />
<include name="vendor/monolog/monolog/src/**/*.php" />
</fileset>
<metadata>
<element name="version" value="2.0.0" />
</metadata>
</pharpackage>
</else>
</if>
</target>
</project>
22 changes: 0 additions & 22 deletions build/autoload.php

This file was deleted.

53 changes: 0 additions & 53 deletions build/build.xml

This file was deleted.

65 changes: 55 additions & 10 deletions composer.json
Expand Up @@ -2,21 +2,66 @@
"name": "guzzle/guzzle",
"type": "library",
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"keywords": ["framework", "http", "rest"],
"keywords": ["framework", "http", "rest", "web service"],
"homepage": "http://www.guzzlephp.org/",
"license": "MIT",
"authors": [
{
"name": "Michael Dowling",
"email": "michael@guzzlephp.org"
"authors": [{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Guzzle Community",
"homepage": "https://github.com/guzzle/guzzle/contributors"
}],
"repositories": {
"zend-log": {
"package": {
"name": "zend/zend-log",
"version": "2.0.0",
"autoload": { "psr-0": { "Zend\\Log": "" } },
"target-dir": "Zend/Log",
"dist": {
"url": "https://github.com/KnpLabs/zend-log/zipball/master",
"type": "zip"
},
"source": {
"url": "https://github.com/KnpLabs/zend-log.git",
"type": "git",
"reference": "master"
}
}
},
{
"name": "Guzzle Community",
"homepage": "https://github.com/guzzle/guzzle/contributors"
"zend-cache": {
"package": {
"name": "zend/zend-cache",
"version": "2.0.0",
"autoload": { "psr-0": { "Zend\\Cache": "" } },
"target-dir": "Zend/Cache",
"dist": {
"url": "https://github.com/KnpLabs/zend-cache/zipball/master",
"type": "zip"
},
"source": {
"url": "https://github.com/KnpLabs/zend-cache.git",
"type": "git",
"reference": "master"
}
}
}
],
},
"require": {
"php": ">=5.3.2"
"php": ">=5.3.2",
"ext-curl": "*",
"symfony/event-dispatcher": "*",
"symfony/validator": "*"
},
"suggest": {
"symfony/class-loader": "*",
"doctrine/common": "*",
"monolog/monolog": "*",
"zend/zend-cache": "*",
"zend/zend-log": "*"
},
"autoload": {
"psr-0": { "Guzzle": "src/" }
Expand Down
2 changes: 0 additions & 2 deletions phpunit.xml.dist
Expand Up @@ -20,8 +20,6 @@
<directory suffix=".php">./src/Guzzle</directory>
<exclude>
<directory suffix="Interface.php">./src/Guzzle</directory>
<file>./src/Guzzle/Common/Event/Subject.php</file>
<file>./src/Guzzle/Common/GuzzleException.php</file>
<file>./src/Guzzle/Http/HttpException.php</file>
</exclude>
</whitelist>
Expand Down

0 comments on commit 4c46e77

Please sign in to comment.