summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Song <vincent.wsong@gmail.com>2016-06-10 15:37:01 -0400
committerVincent Song <vincent.wsong@gmail.com>2016-06-10 15:37:01 -0400
commitec87c5aec0de52271268109f86a1e3aad7fec643 (patch)
tree6b13598b9658ec49d09f2a30a3728a193ff3443f
parent5dd18d3d8141c038ec454b7ae40d53f0d5b94123 (diff)
parent2b42579b80783dee90197579d9a15208cb87a71e (diff)
downloadphp-sparkpost-ec87c5aec0de52271268109f86a1e3aad7fec643.zip
php-sparkpost-ec87c5aec0de52271268109f86a1e3aad7fec643.tar.gz
php-sparkpost-ec87c5aec0de52271268109f86a1e3aad7fec643.tar.bz2
WIP
-rw-r--r--composer.json9
-rw-r--r--composer.lock1108
-rw-r--r--lib/SendGridCompatibility/Email.php259
-rw-r--r--lib/SendGridCompatibility/SendGrid.php26
-rw-r--r--lib/SparkPost/APIResource.php265
-rw-r--r--lib/SparkPost/APIResponseException.php62
-rw-r--r--lib/SparkPost/MessageEvents.php64
-rw-r--r--lib/SparkPost/SparkPost.php208
-rw-r--r--lib/SparkPost/SparkPostException.php26
-rw-r--r--lib/SparkPost/SparkPostPromise.php43
-rw-r--r--lib/SparkPost/SparkPostResponse.php104
11 files changed, 884 insertions, 1290 deletions
diff --git a/composer.json b/composer.json
index 4ad389e..2962dd2 100644
--- a/composer.json
+++ b/composer.json
@@ -16,19 +16,20 @@
},
"require": {
"php": ">=5.5.0",
- "egeloen/http-adapter": "*"
+ "php-http/client-implementation": "^1.0",
+ "guzzlehttp/psr7": "1.3.*"
},
"require-dev": {
"phpunit/phpunit": "4.3.*",
- "guzzlehttp/guzzle": "6.*",
+ "guzzlehttp/guzzle": "5.*",
+ "php-http/guzzle5-adapter": "*",
+ "php-http/message": "*",
"mockery/mockery": "^0.9.4",
- "satooshi/php-coveralls": "dev-master",
"fabpot/php-cs-fixer": "^1.11"
},
"autoload": {
"psr-4": {
"SparkPost\\": "lib/SparkPost/",
- "SparkPost\\SendGridCompatibility\\": "lib/SendGridCompatibility/",
"SparkPost\\Test\\TestUtils\\": "test/unit/TestUtils/"
}
}
diff --git a/composer.lock b/composer.lock
index b1d62a9..a4b401e 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,66 +4,41 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "b07df33073385ce325ea9ef15b5f0da9",
- "content-hash": "c5283ab83042f99acd4dd5b012446822",
+ "hash": "a20653dbdc9cb61db488224520f62aaa",
+ "content-hash": "1023d8370cc9af702c5e2d68fd21ca8d",
"packages": [
{
- "name": "egeloen/http-adapter",
- "version": "0.8.0",
+ "name": "guzzlehttp/guzzle",
+ "version": "5.3.0",
"source": {
"type": "git",
- "url": "https://github.com/egeloen/ivory-http-adapter.git",
- "reference": "9641f11487ec26b24c6bbcee4f267cf62f60b855"
+ "url": "https://github.com/guzzle/guzzle.git",
+ "reference": "f3c8c22471cb55475105c14769644a49c3262b93"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/egeloen/ivory-http-adapter/zipball/9641f11487ec26b24c6bbcee4f267cf62f60b855",
- "reference": "9641f11487ec26b24c6bbcee4f267cf62f60b855",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f3c8c22471cb55475105c14769644a49c3262b93",
+ "reference": "f3c8c22471cb55475105c14769644a49c3262b93",
"shasum": ""
},
"require": {
- "php": ">=5.4.8",
- "zendframework/zend-diactoros": "^1.1"
+ "guzzlehttp/ringphp": "^1.1",
+ "php": ">=5.4.0"
},
"require-dev": {
- "cakephp/cakephp": "^3.0.3",
"ext-curl": "*",
- "guzzle/guzzle": "^3.9.4@dev",
- "guzzlehttp/guzzle": "^4.1.4|^5.0|^6.0",
- "kriswallsmith/buzz": "^0.13",
- "nategood/httpful": "^0.2.17",
"phpunit/phpunit": "^4.0",
- "phpunit/phpunit-mock-objects": "dev-matcher-verify as 2.3.x-dev",
- "psr/log": "^1.0",
- "react/dns": "^0.4.1",
- "react/http-client": "^0.4",
- "satooshi/php-coveralls": "^0.6",
- "symfony/event-dispatcher": "^2.0",
- "zendframework/zend-http": "^2.3.4",
- "zendframework/zendframework1": ">=1.12.9,<=1.12.14|^1.12.16"
- },
- "suggest": {
- "ext-curl": "Allows you to use the cURL adapter",
- "ext-http": "Allows you to use the PECL adapter",
- "guzzle/guzzle": "Allows you to use the Guzzle 3 adapter",
- "guzzlehttp/guzzle": "Allows you to use the Guzzle 4 adapter",
- "kriswallsmith/buzz": "Allows you to use the Buzz adapter",
- "nategood/httpful": "Allows you to use the httpful adapter",
- "psr/log": "Allows you to use the logger event subscriber",
- "symfony/event-dispatcher": "Allows you to use the event lifecycle",
- "symfony/stopwatch": "Allows you to use the stopwatch http adapter and event subscriber",
- "zendframework/zend-http": "Allows you to use the Zend 2 adapter",
- "zendframework/zendframework1": "Allows you to use the Zend 1 adapter"
+ "psr/log": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "0.8-dev"
+ "dev-master": "5.0-dev"
}
},
"autoload": {
"psr-4": {
- "Ivory\\HttpAdapter\\": "src/"
+ "GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -72,47 +47,61 @@
],
"authors": [
{
- "name": "Eric GELOEN",
- "email": "geloen.eric@gmail.com"
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
}
],
- "description": "Issue HTTP request for PHP 5.3+.",
+ "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
+ "homepage": "http://guzzlephp.org/",
"keywords": [
+ "client",
+ "curl",
+ "framework",
"http",
- "http-adapter",
- "http-client",
- "psr-7"
+ "http client",
+ "rest",
+ "web service"
],
- "abandoned": "php-http/httplug",
- "time": "2015-08-12 09:35:40"
+ "time": "2015-05-20 03:47:55"
},
{
- "name": "psr/http-message",
- "version": "1.0",
+ "name": "guzzlehttp/psr7",
+ "version": "1.3.0",
"source": {
"type": "git",
- "url": "https://github.com/php-fig/http-message.git",
- "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
+ "url": "https://github.com/guzzle/psr7.git",
+ "reference": "31382fef2889136415751badebbd1cb022a4ed72"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
- "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/31382fef2889136415751badebbd1cb022a4ed72",
+ "reference": "31382fef2889136415751badebbd1cb022a4ed72",
"shasum": ""
},
"require": {
- "php": ">=5.3.0"
+ "php": ">=5.4.0",
+ "psr/http-message": "~1.0"
+ },
+ "provide": {
+ "psr/http-message-implementation": "1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0.x-dev"
+ "dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
- "Psr\\Http\\Message\\": "src/"
- }
+ "GuzzleHttp\\Psr7\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -120,106 +109,100 @@
],
"authors": [
{
- "name": "PHP-FIG",
- "homepage": "http://www.php-fig.org/"
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
}
],
- "description": "Common interface for HTTP messages",
+ "description": "PSR-7 message implementation",
"keywords": [
"http",
- "http-message",
- "psr",
- "psr-7",
- "request",
- "response"
+ "message",
+ "stream",
+ "uri"
],
- "time": "2015-05-04 20:22:00"
+ "time": "2016-04-13 19:56:01"
},
{
- "name": "zendframework/zend-diactoros",
- "version": "1.3.3",
+ "name": "guzzlehttp/ringphp",
+ "version": "1.1.0",
"source": {
"type": "git",
- "url": "https://github.com/zendframework/zend-diactoros.git",
- "reference": "4d54fde709664562eb63356f0250d527824d05de"
+ "url": "https://github.com/guzzle/RingPHP.git",
+ "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/4d54fde709664562eb63356f0250d527824d05de",
- "reference": "4d54fde709664562eb63356f0250d527824d05de",
+ "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
+ "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
"shasum": ""
},
"require": {
- "php": ">=5.4",
- "psr/http-message": "~1.0"
- },
- "provide": {
- "psr/http-message-implementation": "~1.0.0"
+ "guzzlehttp/streams": "~3.0",
+ "php": ">=5.4.0",
+ "react/promise": "~2.0"
},
"require-dev": {
- "phpunit/phpunit": "~4.6",
- "squizlabs/php_codesniffer": "^2.3.1"
+ "ext-curl": "*",
+ "phpunit/phpunit": "~4.0"
+ },
+ "suggest": {
+ "ext-curl": "Guzzle will use specific adapters if cURL is present"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.3-dev",
- "dev-develop": "1.4-dev"
+ "dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
- "Zend\\Diactoros\\": "src/"
+ "GuzzleHttp\\Ring\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
- "BSD-2-Clause"
+ "MIT"
],
- "description": "PSR HTTP Message implementations",
- "homepage": "https://github.com/zendframework/zend-diactoros",
- "keywords": [
- "http",
- "psr",
- "psr-7"
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
],
- "time": "2016-01-04 21:37:32"
- }
- ],
- "packages-dev": [
+ "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
+ "time": "2015-05-20 03:37:09"
+ },
{
- "name": "doctrine/instantiator",
- "version": "1.0.5",
+ "name": "guzzlehttp/streams",
+ "version": "3.0.0",
"source": {
"type": "git",
- "url": "https://github.com/doctrine/instantiator.git",
- "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
+ "url": "https://github.com/guzzle/streams.git",
+ "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
- "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
+ "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
"shasum": ""
},
"require": {
- "php": ">=5.3,<8.0-DEV"
+ "php": ">=5.4.0"
},
"require-dev": {
- "athletic/athletic": "~0.1.8",
- "ext-pdo": "*",
- "ext-phar": "*",
- "phpunit/phpunit": "~4.0",
- "squizlabs/php_codesniffer": "~2.0"
+ "phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0.x-dev"
+ "dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
- "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+ "GuzzleHttp\\Stream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -228,54 +211,59 @@
],
"authors": [
{
- "name": "Marco Pivetta",
- "email": "ocramius@gmail.com",
- "homepage": "http://ocramius.github.com/"
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
}
],
- "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
- "homepage": "https://github.com/doctrine/instantiator",
+ "description": "Provides a simple abstraction over streams of data",
+ "homepage": "http://guzzlephp.org/",
"keywords": [
- "constructor",
- "instantiate"
+ "Guzzle",
+ "stream"
],
- "time": "2015-06-14 21:17:01"
+ "time": "2014-10-12 19:18:40"
},
{
- "name": "fabpot/php-cs-fixer",
- "version": "v1.11.2",
+ "name": "php-http/discovery",
+ "version": "v0.8.0",
"source": {
"type": "git",
- "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
- "reference": "41f70154642ec0f9ea9ea9c290943f3b5dfa76fc"
+ "url": "https://github.com/php-http/discovery.git",
+ "reference": "fac1240e8a070b3e2f0e38606941de80c849fa53"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/41f70154642ec0f9ea9ea9c290943f3b5dfa76fc",
- "reference": "41f70154642ec0f9ea9ea9c290943f3b5dfa76fc",
+ "url": "https://api.github.com/repos/php-http/discovery/zipball/fac1240e8a070b3e2f0e38606941de80c849fa53",
+ "reference": "fac1240e8a070b3e2f0e38606941de80c849fa53",
"shasum": ""
},
"require": {
- "ext-tokenizer": "*",
- "php": ">=5.3.6",
- "sebastian/diff": "~1.1",
- "symfony/console": "~2.3|~3.0",
- "symfony/event-dispatcher": "~2.1|~3.0",
- "symfony/filesystem": "~2.1|~3.0",
- "symfony/finder": "~2.1|~3.0",
- "symfony/process": "~2.3|~3.0",
- "symfony/stopwatch": "~2.5|~3.0"
+ "php": "^5.4|7.*"
},
"require-dev": {
- "satooshi/php-coveralls": "0.7.*@dev"
+ "henrikbjorn/phpspec-code-coverage": "^1.0",
+ "php-http/httplug": "^1.0",
+ "php-http/message-factory": "^1.0",
+ "phpspec/phpspec": "^2.4",
+ "puli/composer-plugin": "1.0.0-beta9"
+ },
+ "suggest": {
+ "php-http/message": "Allow to use Guzzle or Diactoros factories",
+ "puli/composer-plugin": "Sets up Puli which is required for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details."
},
"bin": [
- "php-cs-fixer"
+ "bin/puli.phar"
],
- "type": "application",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.9-dev"
+ }
+ },
"autoload": {
"psr-4": {
- "Symfony\\CS\\": "Symfony/CS/"
+ "Http\\Discovery\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -284,79 +272,62 @@
],
"authors": [
{
- "name": "Dariusz Rumiński",
- "email": "dariusz.ruminski@gmail.com"
- },
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com"
}
],
- "description": "A tool to automatically fix PHP code style",
- "time": "2016-02-26 07:37:29"
+ "description": "Finds installed HTTPlug implementations and PSR-7 message factories",
+ "homepage": "http://httplug.io",
+ "keywords": [
+ "adapter",
+ "client",
+ "discovery",
+ "factory",
+ "http",
+ "message"
+ ],
+ "time": "2016-02-11 09:53:37"
},
{
- "name": "guzzle/guzzle",
- "version": "v3.8.1",
+ "name": "php-http/guzzle5-adapter",
+ "version": "v0.5.0",
"source": {
"type": "git",
- "url": "https://github.com/guzzle/guzzle.git",
- "reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba"
+ "url": "https://github.com/php-http/guzzle5-adapter.git",
+ "reference": "4edc424fe9c4c620775ee7fab77fa7ae02584765"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/4de0618a01b34aa1c8c33a3f13f396dcd3882eba",
- "reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba",
+ "url": "https://api.github.com/repos/php-http/guzzle5-adapter/zipball/4edc424fe9c4c620775ee7fab77fa7ae02584765",
+ "reference": "4edc424fe9c4c620775ee7fab77fa7ae02584765",
"shasum": ""
},
"require": {
- "ext-curl": "*",
- "php": ">=5.3.3",
- "symfony/event-dispatcher": ">=2.1"
+ "guzzlehttp/guzzle": "^5.1",
+ "php": ">=5.4",
+ "php-http/discovery": "^0.8",
+ "php-http/httplug": "^1.0"
},
- "replace": {
- "guzzle/batch": "self.version",
- "guzzle/cache": "self.version",
- "guzzle/common": "self.version",
- "guzzle/http": "self.version",
- "guzzle/inflection": "self.version",
- "guzzle/iterator": "self.version",
- "guzzle/log": "self.version",
- "guzzle/parser": "self.version",
- "guzzle/plugin": "self.version",
- "guzzle/plugin-async": "self.version",
- "guzzle/plugin-backoff": "self.version",
- "guzzle/plugin-cache": "self.version",
- "guzzle/plugin-cookie": "self.version",
- "guzzle/plugin-curlauth": "self.version",
- "guzzle/plugin-error-response": "self.version",
- "guzzle/plugin-history": "self.version",
- "guzzle/plugin-log": "self.version",
- "guzzle/plugin-md5": "self.version",
- "guzzle/plugin-mock": "self.version",
- "guzzle/plugin-oauth": "self.version",
- "guzzle/service": "self.version",
- "guzzle/stream": "self.version"
+ "provide": {
+ "php-http/client-implementation": "1.0"
},
"require-dev": {
- "doctrine/cache": "*",
- "monolog/monolog": "1.*",
- "phpunit/phpunit": "3.7.*",
- "psr/log": "1.0.*",
- "symfony/class-loader": "*",
- "zendframework/zend-cache": "<2.3",
- "zendframework/zend-log": "<2.3"
+ "ext-curl": "*",
+ "guzzlehttp/psr7": "^1.2",
+ "guzzlehttp/ringphp": "^1.1",
+ "php-http/adapter-integration-tests": "^0.3",
+ "php-http/client-common": "^1.0",
+ "puli/composer-plugin": "1.0.0-beta9"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.8-dev"
+ "dev-master": "0.6-dev"
}
},
"autoload": {
- "psr-0": {
- "Guzzle": "src/",
- "Guzzle\\Tests": "tests/"
+ "psr-4": {
+ "Http\\Adapter\\Guzzle5\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -365,64 +336,54 @@
],
"authors": [
{
- "name": "Michael Dowling",
- "email": "mtdowling@gmail.com",
- "homepage": "https://github.com/mtdowling"
+ "name": "Eric GELOEN",
+ "email": "geloen.eric@gmail.com"
},
{
- "name": "Guzzle Community",
- "homepage": "https://github.com/guzzle/guzzle/contributors"
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com"
}
],
- "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
- "homepage": "http://guzzlephp.org/",
+ "description": "Guzzle 5 HTTP Adapter",
+ "homepage": "http://httplug.io",
"keywords": [
- "client",
- "curl",
- "framework",
- "http",
- "http client",
- "rest",
- "web service"
+ "Guzzle",
+ "http"
],
- "time": "2014-01-28 22:29:15"
+ "time": "2016-02-23 14:14:55"
},
{
- "name": "guzzlehttp/guzzle",
- "version": "6.1.0",
+ "name": "php-http/httplug",
+ "version": "v1.0.0",
"source": {
"type": "git",
- "url": "https://github.com/guzzle/guzzle.git",
- "reference": "66fd14b4d0b8f2389eaf37c5458608c7cb793a81"
+ "url": "https://github.com/php-http/httplug.git",
+ "reference": "2061047ca53a08a6b8f52e997b2a76f386b397dd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/66fd14b4d0b8f2389eaf37c5458608c7cb793a81",
- "reference": "66fd14b4d0b8f2389eaf37c5458608c7cb793a81",
+ "url": "https://api.github.com/repos/php-http/httplug/zipball/2061047ca53a08a6b8f52e997b2a76f386b397dd",
+ "reference": "2061047ca53a08a6b8f52e997b2a76f386b397dd",
"shasum": ""
},
"require": {
- "guzzlehttp/promises": "~1.0",
- "guzzlehttp/psr7": "~1.1",
- "php": ">=5.5.0"
+ "php": ">=5.4",
+ "php-http/promise": "^1.0",
+ "psr/http-message": "^1.0"
},
"require-dev": {
- "ext-curl": "*",
- "phpunit/phpunit": "~4.0",
- "psr/log": "~1.0"
+ "henrikbjorn/phpspec-code-coverage": "^1.0",
+ "phpspec/phpspec": "^2.4"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "6.1-dev"
+ "dev-master": "1.1-dev"
}
},
"autoload": {
- "files": [
- "src/functions_include.php"
- ],
"psr-4": {
- "GuzzleHttp\\": "src/"
+ "Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -431,57 +392,50 @@
],
"authors": [
{
- "name": "Michael Dowling",
- "email": "mtdowling@gmail.com",
- "homepage": "https://github.com/mtdowling"
+ "name": "Eric GELOEN",
+ "email": "geloen.eric@gmail.com"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com"
}
],
- "description": "Guzzle is a PHP HTTP client library",
- "homepage": "http://guzzlephp.org/",
+ "description": "HTTPlug, the HTTP client abstraction for PHP",
+ "homepage": "http://httplug.io",
"keywords": [
"client",
- "curl",
- "framework",
- "http",
- "http client",
- "rest",
- "web service"
+ "http"
],
- "time": "2015-09-08 17:36:26"
+ "time": "2016-01-26 14:34:50"
},
{
- "name": "guzzlehttp/promises",
- "version": "1.0.3",
+ "name": "php-http/promise",
+ "version": "v1.0.0",
"source": {
"type": "git",
- "url": "https://github.com/guzzle/promises.git",
- "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea"
+ "url": "https://github.com/php-http/promise.git",
+ "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/promises/zipball/b1e1c0d55f8083c71eda2c28c12a228d708294ea",
- "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea",
+ "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980",
+ "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980",
"shasum": ""
},
- "require": {
- "php": ">=5.5.0"
- },
"require-dev": {
- "phpunit/phpunit": "~4.0"
+ "henrikbjorn/phpspec-code-coverage": "^1.0",
+ "phpspec/phpspec": "^2.4"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev"
+ "dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
- "GuzzleHttp\\Promise\\": "src/"
- },
- "files": [
- "src/functions_include.php"
- ]
+ "Http\\Promise\\": "src/"
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -489,50 +443,96 @@
],
"authors": [
{
- "name": "Michael Dowling",
- "email": "mtdowling@gmail.com",
- "homepage": "https://github.com/mtdowling"
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com"
+ },
+ {
+ "name": "Joel Wurtz",
+ "email": "joel.wurtz@gmail.com"
}
],
- "description": "Guzzle promises library",
+ "description": "Promise used for asynchronous HTTP requests",
+ "homepage": "http://httplug.io",
"keywords": [
"promise"
],
- "time": "2015-10-15 22:28:00"
+ "time": "2016-01-26 13:27:02"
},
{
- "name": "guzzlehttp/psr7",
- "version": "1.2.3",
+ "name": "psr/http-message",
+ "version": "1.0",
"source": {
"type": "git",
- "url": "https://github.com/guzzle/psr7.git",
- "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b"
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/2e89629ff057ebb49492ba08e6995d3a6a80021b",
- "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
+ "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
"shasum": ""
},
"require": {
- "php": ">=5.4.0",
- "psr/http-message": "~1.0"
+ "php": ">=5.3.0"
},
- "provide": {
- "psr/http-message-implementation": "1.0"
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
},
- "require-dev": {
- "phpunit/phpunit": "~4.0"
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "time": "2015-05-04 20:22:00"
+ },
+ {
+ "name": "react/promise",
+ "version": "v2.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/reactphp/promise.git",
+ "reference": "8025426794f1944de806618671d4fa476dc7626f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/reactphp/promise/zipball/8025426794f1944de806618671d4fa476dc7626f",
+ "reference": "8025426794f1944de806618671d4fa476dc7626f",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev"
+ "dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
- "GuzzleHttp\\Psr7\\": "src/"
+ "React\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
@@ -544,19 +544,172 @@
],
"authors": [
{
- "name": "Michael Dowling",
- "email": "mtdowling@gmail.com",
- "homepage": "https://github.com/mtdowling"
+ "name": "Jan Sorgalla",
+ "email": "jsorgalla@gmail.com"
}
],
- "description": "PSR-7 message implementation",
+ "description": "A lightweight implementation of CommonJS Promises/A for PHP",
+ "time": "2016-05-03 17:50:52"
+ }
+ ],
+ "packages-dev": [
+ {
+ "name": "clue/stream-filter",
+ "version": "v1.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/clue/php-stream-filter.git",
+ "reference": "e3bf9415da163d9ad6701dccb407ed501ae69785"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/e3bf9415da163d9ad6701dccb407ed501ae69785",
+ "reference": "e3bf9415da163d9ad6701dccb407ed501ae69785",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Clue\\StreamFilter\\": "src/"
+ },
+ "files": [
+ "src/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Christian Lück",
+ "email": "christian@lueck.tv"
+ }
+ ],
+ "description": "A simple and modern approach to stream filtering in PHP",
+ "homepage": "https://github.com/clue/php-stream-filter",
"keywords": [
- "http",
- "message",
+ "bucket brigade",
+ "callback",
+ "filter",
+ "php_user_filter",
"stream",
- "uri"
+ "stream_filter_append",
+ "stream_filter_register"
+ ],
+ "time": "2015-11-08 23:41:30"
+ },
+ {
+ "name": "doctrine/instantiator",
+ "version": "1.0.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/instantiator.git",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3,<8.0-DEV"
+ },
+ "require-dev": {
+ "athletic/athletic": "~0.1.8",
+ "ext-pdo": "*",
+ "ext-phar": "*",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.com/"
+ }
+ ],
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+ "homepage": "https://github.com/doctrine/instantiator",
+ "keywords": [
+ "constructor",
+ "instantiate"
+ ],
+ "time": "2015-06-14 21:17:01"
+ },
+ {
+ "name": "fabpot/php-cs-fixer",
+ "version": "v1.11.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
+ "reference": "eeb280e909834603ffe03524dbe0066e77c83084"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/eeb280e909834603ffe03524dbe0066e77c83084",
+ "reference": "eeb280e909834603ffe03524dbe0066e77c83084",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.3.6",
+ "sebastian/diff": "~1.1",
+ "symfony/console": "~2.3|~3.0",
+ "symfony/event-dispatcher": "~2.1|~3.0",
+ "symfony/filesystem": "~2.1|~3.0",
+ "symfony/finder": "~2.1|~3.0",
+ "symfony/process": "~2.3|~3.0",
+ "symfony/stopwatch": "~2.5|~3.0"
+ },
+ "require-dev": {
+ "satooshi/php-coveralls": "0.7.*@dev"
+ },
+ "bin": [
+ "php-cs-fixer"
+ ],
+ "type": "application",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\CS\\": "Symfony/CS/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
],
- "time": "2016-02-18 21:54:00"
+ "authors": [
+ {
+ "name": "Dariusz Rumiński",
+ "email": "dariusz.ruminski@gmail.com"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ }
+ ],
+ "description": "A tool to automatically fix PHP code style",
+ "abandoned": "friendsofphp/php-cs-fixer",
+ "time": "2016-06-07 07:51:27"
},
{
"name": "hamcrest/hamcrest-php",
@@ -605,16 +758,16 @@
},
{
"name": "mockery/mockery",
- "version": "0.9.4",
+ "version": "0.9.5",
"source": {
"type": "git",
"url": "https://github.com/padraic/mockery.git",
- "reference": "70bba85e4aabc9449626651f48b9018ede04f86b"
+ "reference": "4db079511a283e5aba1b3c2fb19037c645e70fc2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/padraic/mockery/zipball/70bba85e4aabc9449626651f48b9018ede04f86b",
- "reference": "70bba85e4aabc9449626651f48b9018ede04f86b",
+ "url": "https://api.github.com/repos/padraic/mockery/zipball/4db079511a283e5aba1b3c2fb19037c645e70fc2",
+ "reference": "4db079511a283e5aba1b3c2fb19037c645e70fc2",
"shasum": ""
},
"require": {
@@ -666,7 +819,123 @@
"test double",
"testing"
],
- "time": "2015-04-02 19:54:00"
+ "time": "2016-05-22 21:52:33"
+ },
+ {
+ "name": "php-http/message",
+ "version": "v1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-http/message.git",
+ "reference": "c8fadec9533f5e34a8a730a947fa76363f3aa620"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-http/message/zipball/c8fadec9533f5e34a8a730a947fa76363f3aa620",
+ "reference": "c8fadec9533f5e34a8a730a947fa76363f3aa620",
+ "shasum": ""
+ },
+ "require": {
+ "clue/stream-filter": "^1.3",
+ "php": ">=5.4",
+ "php-http/message-factory": "^1.0.2",
+ "psr/http-message": "^1.0"
+ },
+ "require-dev": {
+ "coduo/phpspec-data-provider-extension": "^1.0",
+ "ext-zlib": "*",
+ "guzzlehttp/psr7": "^1.0",
+ "henrikbjorn/phpspec-code-coverage": "^1.0",
+ "phpspec/phpspec": "^2.4",
+ "zendframework/zend-diactoros": "^1.0"
+ },
+ "suggest": {
+ "ext-zlib": "Used with compressor/decompressor streams",
+ "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
+ "zendframework/zend-diactoros": "Used with Diactoros Factories"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Http\\Message\\": "src/"
+ },
+ "files": [
+ "src/filters.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com"
+ }
+ ],
+ "description": "HTTP Message related tools",
+ "homepage": "http://php-http.org",
+ "keywords": [
+ "http",
+ "message",
+ "psr-7"
+ ],
+ "time": "2016-03-29 20:44:24"
+ },
+ {
+ "name": "php-http/message-factory",
+ "version": "v1.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-http/message-factory.git",
+ "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1",
+ "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4",
+ "psr/http-message": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com"
+ }
+ ],
+ "description": "Factory interfaces for PSR-7 HTTP Message",
+ "homepage": "http://php-http.org",
+ "keywords": [
+ "factory",
+ "http",
+ "message",
+ "stream",
+ "uri"
+ ],
+ "time": "2015-12-19 14:08:53"
},
{
"name": "phpunit/php-code-coverage",
@@ -818,21 +1087,24 @@
},
{
"name": "phpunit/php-timer",
- "version": "1.0.7",
+ "version": "1.0.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
- "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b"
+ "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
- "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
+ "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
+ "require-dev": {
+ "phpunit/phpunit": "~4|~5"
+ },
"type": "library",
"autoload": {
"classmap": [
@@ -855,7 +1127,7 @@
"keywords": [
"timer"
],
- "time": "2015-06-21 08:01:12"
+ "time": "2016-05-12 18:03:57"
},
{
"name": "phpunit/php-token-stream",
@@ -1037,119 +1309,6 @@
"time": "2015-10-02 06:51:40"
},
{
- "name": "psr/log",
- "version": "1.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/php-fig/log.git",
- "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
- "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
- "shasum": ""
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Psr\\Log\\": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "PHP-FIG",
- "homepage": "http://www.php-fig.org/"
- }
- ],
- "description": "Common interface for logging libraries",
- "keywords": [
- "log",
- "psr",
- "psr-3"
- ],
- "time": "2012-12-21 11:40:51"
- },
- {
- "name": "satooshi/php-coveralls",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/satooshi/php-coveralls.git",
- "reference": "2fbf803803d179ab1082807308a67bbd5a760c70"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/50c60bb64054974f8ed7540ae6e75fd7981a5fd3",
- "reference": "2fbf803803d179ab1082807308a67bbd5a760c70",
- "shasum": ""
- },
- "require": {
- "ext-json": "*",
- "ext-simplexml": "*",
- "guzzle/guzzle": ">=2.7",
- "php": ">=5.3",
- "psr/log": "1.0.0",
- "symfony/config": ">=2.0",
- "symfony/console": ">=2.0",
- "symfony/stopwatch": ">=2.2",
- "symfony/yaml": ">=2.0"
- },
- "require-dev": {
- "apigen/apigen": "2.8.*@stable",
- "pdepend/pdepend": "dev-master as 2.0.0",
- "phpmd/phpmd": "dev-master",
- "phpunit/php-invoker": ">=1.1.0,<1.2.0",
- "phpunit/phpunit": "3.7.*@stable",
- "sebastian/finder-facade": "dev-master",
- "sebastian/phpcpd": "1.4.*@stable",
- "squizlabs/php_codesniffer": "1.4.*@stable",
- "theseer/fdomdocument": "dev-master"
- },
- "suggest": {
- "symfony/http-kernel": "Allows Symfony integration"
- },
- "bin": [
- "composer/bin/coveralls"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "0.7-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Satooshi\\Component": "src/",
- "Satooshi\\Bundle": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Kitamura Satoshi",
- "email": "with.no.parachute@gmail.com",
- "homepage": "https://www.facebook.com/satooshi.jp"
- }
- ],
- "description": "PHP client library for Coveralls API",
- "homepage": "https://github.com/satooshi/php-coveralls",
- "keywords": [
- "ci",
- "coverage",
- "github",
- "test"
- ],
- "time": "2014-11-11 15:35:34"
- },
- {
"name": "sebastian/comparator",
"version": "1.2.0",
"source": {
@@ -1267,16 +1426,16 @@
},
{
"name": "sebastian/environment",
- "version": "1.3.5",
+ "version": "1.3.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
- "reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf"
+ "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf",
- "reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716",
+ "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716",
"shasum": ""
},
"require": {
@@ -1313,7 +1472,7 @@
"environment",
"hhvm"
],
- "time": "2016-02-26 18:40:46"
+ "time": "2016-05-17 03:18:57"
},
{
"name": "sebastian/exporter",
@@ -1470,70 +1629,17 @@
"time": "2015-06-21 13:59:46"
},
{
- "name": "symfony/config",
- "version": "v3.0.3",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/config.git",
- "reference": "79a97025f7bf4bbf8352b5df1905aa136a531066"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/config/zipball/79a97025f7bf4bbf8352b5df1905aa136a531066",
- "reference": "79a97025f7bf4bbf8352b5df1905aa136a531066",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5.9",
- "symfony/filesystem": "~2.8|~3.0"
- },
- "suggest": {
- "symfony/yaml": "To use the yaml reference dumper"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.0-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Config\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Config Component",
- "homepage": "https://symfony.com",
- "time": "2016-02-23 15:16:06"
- },
- {
"name": "symfony/console",
- "version": "v3.0.3",
+ "version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "2ed5e2706ce92313d120b8fe50d1063bcfd12e04"
+ "reference": "f62db5b8afec27073a4609b8c84b1f9936652259"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/2ed5e2706ce92313d120b8fe50d1063bcfd12e04",
- "reference": "2ed5e2706ce92313d120b8fe50d1063bcfd12e04",
+ "url": "https://api.github.com/repos/symfony/console/zipball/f62db5b8afec27073a4609b8c84b1f9936652259",
+ "reference": "f62db5b8afec27073a4609b8c84b1f9936652259",
"shasum": ""
},
"require": {
@@ -1553,7 +1659,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "3.1-dev"
}
},
"autoload": {
@@ -1580,20 +1686,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2016-02-28 16:24:34"
+ "time": "2016-05-30 06:58:39"
},
{
"name": "symfony/event-dispatcher",
- "version": "v3.0.3",
+ "version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa"
+ "reference": "0343b2cedd0edb26cdc791212a8eb645c406018b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa",
- "reference": "4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0343b2cedd0edb26cdc791212a8eb645c406018b",
+ "reference": "0343b2cedd0edb26cdc791212a8eb645c406018b",
"shasum": ""
},
"require": {
@@ -1613,7 +1719,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "3.1-dev"
}
},
"autoload": {
@@ -1640,20 +1746,20 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
- "time": "2016-01-27 05:14:46"
+ "time": "2016-04-12 18:27:47"
},
{
"name": "symfony/filesystem",
- "version": "v3.0.3",
+ "version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "23ae8f9648d0a7fe94a47c8e20e5bf37c489a451"
+ "reference": "5751e80d6f94b7c018f338a4a7be0b700d6f3058"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/23ae8f9648d0a7fe94a47c8e20e5bf37c489a451",
- "reference": "23ae8f9648d0a7fe94a47c8e20e5bf37c489a451",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/5751e80d6f94b7c018f338a4a7be0b700d6f3058",
+ "reference": "5751e80d6f94b7c018f338a4a7be0b700d6f3058",
"shasum": ""
},
"require": {
@@ -1662,7 +1768,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "3.1-dev"
}
},
"autoload": {
@@ -1689,20 +1795,20 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2016-02-23 15:16:06"
+ "time": "2016-04-12 18:27:47"
},
{
"name": "symfony/finder",
- "version": "v3.0.3",
+ "version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "623bda0abd9aa29e529c8e9c08b3b84171914723"
+ "reference": "40d17ed287bf51a2f884c4619ce8ff2a1c5cd219"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/623bda0abd9aa29e529c8e9c08b3b84171914723",
- "reference": "623bda0abd9aa29e529c8e9c08b3b84171914723",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/40d17ed287bf51a2f884c4619ce8ff2a1c5cd219",
+ "reference": "40d17ed287bf51a2f884c4619ce8ff2a1c5cd219",
"shasum": ""
},
"require": {
@@ -1711,7 +1817,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "3.1-dev"
}
},
"autoload": {
@@ -1738,20 +1844,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2016-01-27 05:14:46"
+ "time": "2016-05-13 18:06:41"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.1.0",
+ "version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "1289d16209491b584839022f29257ad859b8532d"
+ "reference": "dff51f72b0706335131b00a7f49606168c582594"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d",
- "reference": "1289d16209491b584839022f29257ad859b8532d",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594",
+ "reference": "dff51f72b0706335131b00a7f49606168c582594",
"shasum": ""
},
"require": {
@@ -1763,7 +1869,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1-dev"
+ "dev-master": "1.2-dev"
}
},
"autoload": {
@@ -1797,20 +1903,20 @@
"portable",
"shim"
],
- "time": "2016-01-20 09:13:37"
+ "time": "2016-05-18 14:26:46"
},
{
"name": "symfony/process",
- "version": "v3.0.3",
+ "version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "dfecef47506179db2501430e732adbf3793099c8"
+ "reference": "1574f3451b40fa9bbae518ef71d19a56f409cac0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/dfecef47506179db2501430e732adbf3793099c8",
- "reference": "dfecef47506179db2501430e732adbf3793099c8",
+ "url": "https://api.github.com/repos/symfony/process/zipball/1574f3451b40fa9bbae518ef71d19a56f409cac0",
+ "reference": "1574f3451b40fa9bbae518ef71d19a56f409cac0",
"shasum": ""
},
"require": {
@@ -1819,7 +1925,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "3.1-dev"
}
},
"autoload": {
@@ -1846,20 +1952,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2016-02-02 13:44:19"
+ "time": "2016-04-12 19:11:33"
},
{
"name": "symfony/stopwatch",
- "version": "v3.0.3",
+ "version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
- "reference": "4a204804952ff267ace88cf499e0b4bb302a475e"
+ "reference": "4670f122fa32a4900003a6802f6b8575f3f0b17e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4a204804952ff267ace88cf499e0b4bb302a475e",
- "reference": "4a204804952ff267ace88cf499e0b4bb302a475e",
+ "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4670f122fa32a4900003a6802f6b8575f3f0b17e",
+ "reference": "4670f122fa32a4900003a6802f6b8575f3f0b17e",
"shasum": ""
},
"require": {
@@ -1868,7 +1974,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "3.1-dev"
}
},
"autoload": {
@@ -1895,20 +2001,20 @@
],
"description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com",
- "time": "2016-01-03 15:35:16"
+ "time": "2016-03-04 07:56:56"
},
{
"name": "symfony/yaml",
- "version": "v2.8.3",
+ "version": "v2.8.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "2a4ee40acb880c56f29fb1b8886e7ffe94f3b995"
+ "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/2a4ee40acb880c56f29fb1b8886e7ffe94f3b995",
- "reference": "2a4ee40acb880c56f29fb1b8886e7ffe94f3b995",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/815fabf3f48c7d1df345a69d1ad1a88f59757b34",
+ "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34",
"shasum": ""
},
"require": {
@@ -1944,14 +2050,12 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2016-02-23 07:41:20"
+ "time": "2016-06-06 11:11:27"
}
],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": {
- "satooshi/php-coveralls": 20
- },
+ "stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
diff --git a/lib/SendGridCompatibility/Email.php b/lib/SendGridCompatibility/Email.php
deleted file mode 100644
index 3ca2466..0000000
--- a/lib/SendGridCompatibility/Email.php
+++ /dev/null
@@ -1,259 +0,0 @@
-<?php
-
-namespace SparkPost\SendGridCompatibility;
-
-class Email
-{
- public $model;
-
- /**
- * Sets up the model for saving the configuration.
- */
- public function __construct()
- {
- $this->model = array();
- }
-
- /**
- * adds addresses as recipients.
- *
- * @param string $address
- * @param string $name optional
- *
- * @return $this
- */
- public function addTo($address, $name = null)
- {
- if (!isset($this->model['recipients'])) {
- $this->model['recipients'] = array();
- }
-
- if (isset($name)) {
- $address = array('address' => array('email' => $address, 'name' => $name));
- } else {
- $address = array('address' => array('email' => $address));
- }
-
- array_push($this->model['recipients'], $address);
-
- return $this;
- }
-
- /**
- * explicitly sets a list of addresses.
- *
- * @param array $addresses
- *
- * @return $this
- */
- public function setTos(array $addresses)
- {
- $this->model['recipients'] = $addresses;
-
- return $this;
- }
-
- /**
- * sets the from address.
- *
- * @param string $address
- *
- * @return $this
- */
- public function setFrom($address)
- {
- $this->model['from'] = array('email' => $address);
-
- return $this;
- }
-
- /**
- * Sets the name for the from address.
- *
- * @param string $name
- *
- * @return $this
- *
- * @throws \Exception
- */
- public function setFromName($name)
- {
- if (!isset($this->model['from'])) {
- throw new \Exception('Must set \'From\' prior to setting \'From Name\'.');
- }
- $this->model['from']['name'] = $name;
-
- return $this;
- }
-
- /**
- * sets the reply to field.
- *
- * @param string $address
- *
- * @return $this
- */
- public function setReplyTo($address)
- {
- $this->model['replyTo'] = $address;
-
- return $this;
- }
-
- /**
- * throws an error because bcc fields are not yet implemented.
- *
- * @throws \Exception
- *
- * @param string $address
- *
- * @return $this
- */
- public function addBcc($address)
- {
- throw new \Exception('Adding bcc recipients is not yet supported, try adding them as a \'to\' address');
- }
-
- /**
- * sets the subject header.
- *
- * @param string $subject
- *
- * @return $this
- */
- public function setSubject($subject)
- {
- $this->model['subject'] = $subject;
-
- return $this;
- }
-
- /**
- * sets the text body.
- *
- * @param string $text
- *
- * @return $this
- */
- public function setText($text)
- {
- $this->model['text'] = $text;
-
- return $this;
- }
-
- /**
- * sets the html body.
- *
- * @param string $html
- *
- * @return $this
- */
- public function setHtml($html)
- {
- $this->model['html'] = $html;
-
- return $this;
- }
-
- /**
- * Throws an exception since adding categories is not yet supported.
- *
- * @param string $category
- *
- * @throws \Exception
- */
- public function addCategory($category)
- {
- throw new \Exception('Adding categories is not yet supported');
- }
-
- /**
- * Throws an exception since adding attachments is not yet supported.
- *
- * @throws \Exception
- *
- * @param mixed $attachment
- */
- public function addAttachment($attachment)
- {
- throw new \Exception('Adding attachments is not yet supported');
- }
-
- /**
- * Adds transmission level substitution data.
- *
- * @param string $name
- * @param mixed $values
- *
- * @return $this
- */
- public function addSubstitution($name, $values)
- {
- if (!isset($this->model['substitutionData'])) {
- $this->model['substitutionData'] = array();
- }
- $this->model['substitutionData'][$name] = $values;
-
- return $this;
- }
-
- /**
- * Adds transmission level substitution data.
- *
- * @param string $name
- * @param mixed $values
- */
- public function addSection($name, $values)
- {
- $this->addSubstitution($name, $values);
- }
-
- /**
- * Throws an exception because arguments for third party systems is not supported.
- *
- * @throws \Exception
- *
- * @param mixed $value
- */
- public function addUniqueArg($key, $value)
- {
- throw new \Exception('Adding Unique Arguments is not yet supported');
- }
-
- /**
- * Throws an exception because arguments for third party systems is not supported.
- *
- * @throws \Exception
- *
- * @param mixed $values
- */
- public function setUniqueArgs(array $values)
- {
- throw new \Exception('Setting Unique Arguments is not yet supported');
- }
-
- /**
- * Adds custom headers to the email header.
- *
- * @param string $name
- * @param string $value
- */
- public function addHeader($name, $value)
- {
- if (!isset($this->model['customHeaders'])) {
- $this->model['customHeaders'] = array();
- }
- $this->model['customHeaders'][$name] = $value;
- }
-
- /**
- * converts this object to a configuration for a SparkPost transmission.
- *
- * @return array
- */
- public function toSparkPostTransmission()
- {
- return $this->model;
- }
-}
diff --git a/lib/SendGridCompatibility/SendGrid.php b/lib/SendGridCompatibility/SendGrid.php
deleted file mode 100644
index c5e84c1..0000000
--- a/lib/SendGridCompatibility/SendGrid.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-namespace SparkPost\SendGridCompatibility;
-
-use SparkPost\SparkPost;
-
-class SendGrid
-{
- private $sparky;
-
- public function __construct($username, $password, $options = null, $httpAdapter)
- {
- //username isn't used in our system
- $opts = array('key' => $password);
- if (!is_null($options)) {
- $opts = array_merge($opts, $options);
- }
-
- $this->sparky = new SparkPost($httpAdapter, $opts);
- }
-
- public function send(Email $email)
- {
- $this->sparky->transmission->send($email->toSparkPostTransmission());
- }
-}
diff --git a/lib/SparkPost/APIResource.php b/lib/SparkPost/APIResource.php
deleted file mode 100644
index 36b03a8..0000000
--- a/lib/SparkPost/APIResource.php
+++ /dev/null
@@ -1,265 +0,0 @@
-<?php
-
-namespace SparkPost;
-
-/**
- * SDK interface for managing SparkPost API endpoints.
- */
-class APIResource
-{
- /**
- * name of the API endpoint, mainly used for URL construction.
- * This is public to provide an interface.
- *
- * @var string
- */
- public $endpoint;
-
- /**
- * Mapping for values passed into the send method to the values needed for the respective API.
- *
- * @var array
- */
- protected static $parameterMappings = [];
-
- /**
- * Sets up default structure and default values for the model that is acceptable by the API.
- *
- * @var array
- */
- protected static $structure = [];
-
- /**
- * SparkPost reference for httpAdapters and configs.
- */
- protected $sparkpost;
-
- /**
- * Initializes config and httpAdapter for use later.
- *
- * @param $sparkpost \SparkPost\SparkPost provides api configuration information
- */
- public function __construct(SparkPost $sparkpost)
- {
- $this->sparkpost = $sparkpost;
- }
-
- /**
- * Private Method helper to reference parameter mappings and set the right value for the right parameter.
- *
- * @param array $model (pass by reference) the set of values to map
- * @param string $mapKey a dot syntax path determining which value to set
- * @param mixed $value value for the given path
- */
- protected function setMappedValue(&$model, $mapKey, $value)
- {
- //get mapping
- if (empty(static::$parameterMappings)) {
- // if parameterMappings is empty we can assume that no wrapper is defined
- // for the current endpoint and we will use the mapKey to define the mappings directly
- $mapPath = $mapKey;
- } elseif (array_key_exists($mapKey, static::$parameterMappings)) {
- // use only defined parameter mappings to construct $model
- $mapPath = static::$parameterMappings[$mapKey];
- } else {
- return;
- }
-
- $path = explode('.', $mapPath);
- $temp = &$model;
- foreach ($path as $key) {
- if (!isset($temp[$key])) {
- $temp[$key] = null;
- }
- $temp = &$temp[$key];
- }
- $temp = $value;
- }
-
- /**
- * maps values from the passed in model to those needed for the request.
- *
- * @param array $requestConfig the passed in model
- * @param array $model the set of defaults
- *
- * @return array A model ready for the body of a request
- */
- protected function buildRequestModel(array $requestConfig, array $model = [])
- {
- foreach ($requestConfig as $key => $value) {
- $this->setMappedValue($model, $key, $value);
- }
-
- return $model;
- }
-
- /**
- * posts to the api with a supplied body.
- *
- * @param array $body post body for the request
- *
- * @return array Result of the request
- */
- public function create(array $body = [])
- {
- return $this->callResource('post', null, ['body' => $body]);
- }
-
- /**
- * Makes a put request to the api with a supplied body.
- *
- * @param $resourcePath
- * @param array $body Put body for the request
- *
- * @return array Result of the request
- *
- * @throws APIResponseException
- */
- public function update($resourcePath, array $body = [])
- {
- return $this->callResource('put', $resourcePath, ['body' => $body]);
- }
-
- /**
- * Wrapper method for issuing GET request to current API endpoint.
- *
- * @param string $resourcePath (optional) string resource path of specific resource
- * @param array $query (optional) query string parameters
- *
- * @return array Result of the request
- */
- public function get($resourcePath = null, array $query = [])
- {
- return $this->callResource('get', $resourcePath, ['query' => $query]);
- }
-
- /**
- * Wrapper method for issuing DELETE request to current API endpoint.
- *
- * @param string $resourcePath (optional) string resource path of specific resource
- * @param array $query (optional) query string parameters
- *
- * @return array Result of the request
- */
- public function delete($resourcePath = null, array $query = [])
- {
- return $this->callResource('delete', $resourcePath, ['query' => $query]);
- }
-
- /**
- * assembles a URL for a request.
- *
- * @param string $resourcePath path after the initial endpoint
- * @param array $options array with an optional value of query with values to build a querystring from. Any
- * query elements that are themselves arrays will be imploded into a comma separated list.
- *
- * @return string the assembled URL
- */
- private function buildUrl($resourcePath, $options)
- {
- $url = "/{$this->endpoint}/";
- if (!is_null($resourcePath)) {
- $url .= $resourcePath;
- }
-
- if (!empty($options['query'])) {
- // check each query element - if it's an array, implode it to match the API-accepted format
- foreach ($options['query'] as &$element) {
- if (is_array($element)) {
- $element = implode(',', $element);
- }
- }
-
- $queryString = http_build_query($options['query']);
- $url .= '?'.$queryString;
- }
-
- return $url;
- }
-
- /**
- * Prepares a body for put and post requests.
- *
- * @param array $options array with an optional value of body with values to build a request body from.
- *
- * @return string|null A json encoded string or null if no body was provided
- */
- private function buildBody($options)
- {
- $body = null;
- if (!empty($options['body'])) {
- $model = static::$structure;
- $requestModel = $this->buildRequestModel($options['body'], $model);
- $body = json_encode($requestModel);
- }
-
- return $body;
- }
-
- /**
- * Private Method for issuing GET and DELETE request to current API endpoint.
- *
- * This method is responsible for getting the collection _and_
- * a specific entity from the API endpoint
- *
- * If resourcePath parameter is omitted, then we fetch the collection
- *
- * @param string $action HTTP method type
- * @param string $resourcePath (optional) string resource path of specific resource
- * @param array $options (optional) query string parameters
- *
- * @return array Result set of action performed on resource
- *
- * @throws APIResponseException
- */
- private function callResource($action, $resourcePath = null, $options = [])
- {
- $action = strtoupper($action); // normalize
-
- $url = $this->buildUrl($resourcePath, $options);
- $body = $this->buildBody($options);
-
- //make request
- try {
- $response = $this->sparkpost->httpAdapter->send($url, $action, $this->sparkpost->getHttpHeaders(), $body);
-
- $statusCode = $response->getStatusCode();
-
- // Handle 4XX responses, 5XX responses will throw an HttpAdapterException
- if ($statusCode < 400) {
- return json_decode($response->getBody()->getContents(), true);
- } elseif ($statusCode === 403) {
- $response = json_decode($response->getBody(), true);
- throw new APIResponseException(
- 'Request forbidden',
- $statusCode,
- isset($response['errors'][0]['message']) ? $response['errors'][0]['message'] : 'Request forbidden',
- isset($response['errors'][0]['code']) ? $response['errors'][0]['code'] : 1100,
- isset($response['errors'][0]['description']) ? $response['errors'][0]['description'] : 'Does this API Key have the correct permissions?'
- );
- } elseif ($statusCode === 404) {
- throw new APIResponseException('The specified resource does not exist', 404);
- } else {
- $response = json_decode($response->getBody(), true);
- throw new APIResponseException(
- 'Received bad response from '.ucfirst($this->endpoint),
- $statusCode,
- isset($response['errors'][0]['message']) ? $response['errors'][0]['message'] : '',
- isset($response['errors'][0]['code']) ? $response['errors'][0]['code'] : 0,
- isset($response['errors'][0]['description']) ? $response['errors'][0]['description'] : ''
- );
- }
- }
-
- /*
- * Configuration Errors, and a catch all for other errors
- */
- catch (\Exception $exception) {
- if ($exception instanceof APIResponseException) {
- throw $exception;
- }
-
- throw new APIResponseException('Unable to contact '.ucfirst($this->endpoint).' API: '.$exception->getMessage(), $exception->getCode());
- }
- }
-}
diff --git a/lib/SparkPost/APIResponseException.php b/lib/SparkPost/APIResponseException.php
deleted file mode 100644
index a491b3c..0000000
--- a/lib/SparkPost/APIResponseException.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-namespace SparkPost;
-
-class APIResponseException extends \Exception
-{
- /**
- * @var string
- */
- protected $apiMessage;
-
- /**
- * @var int
- */
- protected $apiCode;
-
- /**
- * @var string
- */
- protected $apiDescription;
-
- /**
- * Construct the exception.
- */
- public function __construct($message = '', $code = 0, $apiMessage = '', $apiCode = 0, $apiDescription = '')
- {
- $this->apiMessage = $apiMessage;
- $this->apiCode = $apiCode;
- $this->apiDescription = $apiDescription;
- parent::__construct($message, $code);
- }
-
- /**
- * Gets the Exception message.
- *
- * @return string the Exception message as a string.
- */
- public function getAPIMessage()
- {
- return $this->apiMessage;
- }
-
- /**
- * Gets the API Exception code.
- *
- * @return int the exception code as integer.
- */
- public function getAPICode()
- {
- return $this->apiCode;
- }
-
- /**
- * Gets the Exception description.
- *
- * @return string the Exception description as a string.
- */
- public function getAPIDescription()
- {
- return $this->apiDescription;
- }
-}
diff --git a/lib/SparkPost/MessageEvents.php b/lib/SparkPost/MessageEvents.php
deleted file mode 100644
index d44a30f..0000000
--- a/lib/SparkPost/MessageEvents.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-namespace SparkPost;
-
-/**
- * SDK class for querying the Message Events API.
- *
- * @see https://developers.sparkpost.com/api/#/reference/message-events
- */
-class MessageEvents extends APIResource
-{
- /**
- * @var string
- */
- public $endpoint = 'message-events';
-
- /**
- * Method for issuing search requests to the Message Events API.
- *
- * The method passes-through all of the query parameters - the valid ones are listed at
- *
- * @link https://developers.sparkpost.com/api/#/reference/message-events/events-documentation/search-for-message-events
- *
- * @param array $queryParams The query parameters. Note that a query parameter containing an array
- * is collapsed into a comma-separated list.
- *
- * @return array The result of the query.
- */
- public function search(array $queryParams)
- {
- // check for DateTime objects & replace them with the formatted string equivalent
- foreach (['from', 'to'] as $dateTimeParam) {
- if (isset($queryParams[$dateTimeParam]) && $queryParams[$dateTimeParam] instanceof \DateTime) {
- // the message events API doesn't allow the seconds or GMT offset, so strip them
- $queryParams[$dateTimeParam] = substr($queryParams[$dateTimeParam]->format(\DateTime::ATOM), 0, 16);
- }
- }
-
- return $this->get(null, $queryParams);
- }
-
- /**
- * List descriptions of the event fields that could be included in a response from the MessageEvent::search() method.
- *
- * @return array The event field descriptions.
- */
- public function documentation()
- {
- return $this->get('events/documentation');
- }
-
- /**
- * List examples of the event data that will be included in a response from the MessageEvent::search() method.
- *
- * @param array $events (optional) Event types for which to get a sample payload. If not provided, samples
- * for all events will be returned.
- *
- * @return array Sample events.
- */
- public function samples(array $events = [])
- {
- return $this->get('events/samples', ['events' => $events]);
- }
-}
diff --git a/lib/SparkPost/SparkPost.php b/lib/SparkPost/SparkPost.php
index ff8b456..53a669b 100644
--- a/lib/SparkPost/SparkPost.php
+++ b/lib/SparkPost/SparkPost.php
@@ -2,151 +2,143 @@
namespace SparkPost;
-use Ivory\HttpAdapter\Configuration;
-use Ivory\HttpAdapter\HttpAdapterInterface;
+use Http\Client\HttpClient;
+use Http\Client\HttpAsyncClient;
+use GuzzleHttp\Psr7\Request as Request;
class SparkPost
{
- public $transmission;
- public $messageEvents;
-
- /**
- * Library version, used for setting User-Agent.
- */
- private $version = '1.2.1';
-
- /**
- * Connection config for making requests.
- */
- private $config;
-
- /**
- * @var \Ivory\HttpAdapter\HttpAdapterInterface to make requests through.
- */
- public $httpAdapter;
-
- /**
- * Default config values. Passed in values will override these.
- */
- private static $apiDefaults = [
+ private $version = '2.0.0';
+ public $httpClient;
+ private $options;
+
+ private static $defaultOptions = [
'host' => 'api.sparkpost.com',
'protocol' => 'https',
'port' => 443,
- 'strictSSL' => true,
'key' => '',
'version' => 'v1',
- 'timeout' => 10
+ 'timeout' => 10,
+ 'async' => true
];
- /**
- * Sets up httpAdapter and config.
- *
- * Sets up instances of sub libraries.
- *
- * @param \Ivory\HttpAdapter\HttpAdapterInterface $httpAdapter - An adapter for making http requests
- * @param string | array $settingsConfig - Hashmap that contains config values
- * for the SDK to connect to SparkPost. If its a string we assume that
- * its just they API Key.
- */
- public function __construct($httpAdapter, $settingsConfig)
+ public $transmissions;
+
+ public function __construct(HttpClient $httpClient, $options)
{
- //config needs to be setup before adapter because of default adapter settings
- $this->setConfig($settingsConfig);
- $this->setHttpAdapter($httpAdapter);
+ $this->setOptions($options);
+ $this->setHttpClient($httpClient);
+ $this->setupEndpoints();
+ }
- $this->transmission = new Transmission($this);
- $this->messageEvents = new MessageEvents($this);
+ public function request($method = 'GET', $uri = '', $payload = [], $headers = []) {
+ if ($this->options['async'] === true && $this->httpClient instanceof HttpAsyncClient) {
+ $this->asyncRequest($method, $uri, $payload, $headers);
+ }
+ else {
+ $this->syncRequest($method, $uri, $payload, $headers);
+ }
}
- /**
- * Creates an unwrapped api interface for endpoints that aren't yet supported.
- * The new resource is attached to this object as well as returned.
- *
- * @param string $endpoint
- *
- * @return APIResource - the unwrapped resource
- */
- public function setupUnwrapped($endpoint)
+ public function syncRequest($method = 'GET', $uri = '', $payload = [], $headers = [])
{
- $this->{$endpoint} = new APIResource($this);
- $this->{$endpoint}->endpoint = $endpoint;
+ $request = $this->buildRequest($method, $uri, $payload, $headers);
+ try
+ {
+ return new SparkPostResponse($this->httpClient->sendRequest($request));
+ }
+ catch (\Exception $exception)
+ {
+ throw new SparkPostException($exception);
+ }
+ }
- return $this->{$endpoint};
+ public function asyncRequest($method = 'GET', $uri = '', $payload = [], $headers = [])
+ {
+ if ($this->httpClient instanceof HttpAsyncClient) {
+ $request = $this->buildRequest($method, $uri, $payload, $headers);
+ return new SparkPostPromise($this->httpClient->sendAsyncRequest($request));
+ }
+ else {
+ throw new Exception('Your http client can not send asynchronous requests.');
+ }
}
- /**
- * Merges passed in headers with default headers for http requests.
- */
- public function getHttpHeaders()
+ private function buildRequest($method, $uri, $payload, $headers)
{
- $defaultOptions = [
- 'Authorization' => $this->config['key'],
- 'Content-Type' => 'application/json',
- ];
+
+ $method = trim(strtoupper($method));
+
+ if ($method === 'GET'){
+ $params = $payload;
+ $body = [];
+ }
+ else {
+ $params = [];
+ $body = $payload;
+ }
- return $defaultOptions;
+ $url = $this->getUrl($uri, $params);
+ $headers = $this->getHttpHeaders($headers);
+
+ return new Request($method, $url, $headers, json_encode($body));
}
- /**
- * Helper function for getting the configuration for http requests.
- *
- * @param array $config
- *
- * @return Configuration
- */
- private function getHttpConfig($config)
+ public function getHttpHeaders($headers = [])
{
- // create Configuration for http adapter
- $httpConfig = new Configuration();
- $baseUrl = $config['protocol'].'://'.$config['host'].($config['port'] ? ':'.$config['port'] : '').'/api/'.$config['version'];
- $httpConfig->setBaseUri($baseUrl);
- $httpConfig->setTimeout($this->config['timeout']);
- $httpConfig->setUserAgent('php-sparkpost/'.$this->version);
-
- return $httpConfig;
+ $constantHeaders = [
+ 'Authorization' => $this->options['key'],
+ 'Content-Type' => 'application/json'
+ ];
+
+ foreach ($constantHeaders as $key => $value) {
+ $headers[$key] = $value;
+ }
+
+ return $headers;
}
- /**
- * Validates and sets up the httpAdapter.
- *
- * @param $httpAdapter \Ivory\HttpAdapter\HttpAdapterInterface to make requests through.
- *
- * @throws \Exception
- */
- public function setHttpAdapter(HttpAdapterInterface $httpAdapter)
+ public function getUrl($path, $params) {
+ $options = $this->options;
+
+ for ($index = 0; $index < count($params); $index++) {
+ if (is_array($params[$index]))
+ $params[$index] = implode(',', $params);
+ }
+
+ $paramsString = http_build_query($params);
+
+ return $options['protocol'].'://'.$options['host'].($options['port'] ? ':'.$options['port'] : '').'/api/'.$options['version'].'/'.$path.($paramsString ? '?'.$paramsString : '');
+ }
+
+ public function setHttpClient(HttpClient $httpClient)
{
- $this->httpAdapter = $httpAdapter;
- $this->httpAdapter->setConfiguration($this->getHttpConfig($this->config));
+ $this->httpClient = $httpClient;
}
- /**
- * Allows the user to pass in values to override the defaults and set their API key.
- *
- * @param string | array $settingsConfig - Hashmap that contains config values
- * for the SDK to connect to SparkPost. If its a string we assume that
- * its just they API Key.
- *
- * @throws \Exception
- */
- public function setConfig($settingsConfig)
+ public function setOptions($options)
{
- // if the config map is a string we should assume that its an api key
- if (is_string($settingsConfig)) {
- $settingsConfig = ['key' => $settingsConfig];
+ // if the options map is a string we should assume that its an api key
+ if (is_string($options)) {
+ $options = ['key' => $options];
}
// Validate API key because its required
- if (!isset($settingsConfig['key']) || !preg_match('/\S/', $settingsConfig['key'])) {
+ if (!isset($this->options['key']) && (!isset($options['key']) || !preg_match('/\S/', $options['key']))) {
throw new \Exception('You must provide an API key');
}
- $this->config = self::$apiDefaults;
+ $this->options = isset($this->options) ? $this->options : self::$defaultOptions;
- // set config, overriding defaults
- foreach ($settingsConfig as $configOption => $configValue) {
- if (key_exists($configOption, $this->config)) {
- $this->config[$configOption] = $configValue;
+ // set options, overriding defaults
+ foreach ($options as $option => $value) {
+ if (key_exists($option, $this->options)) {
+ $this->options[$option] = $value;
}
}
}
+
+ private function setupEndpoints() {
+ $this->transmissions = new Transmission($this);
+ }
}
diff --git a/lib/SparkPost/SparkPostException.php b/lib/SparkPost/SparkPostException.php
new file mode 100644
index 0000000..92be3d5
--- /dev/null
+++ b/lib/SparkPost/SparkPostException.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace SparkPost;
+
+use Http\Client\Exception\HttpException as HttpException;
+
+class SparkPostException extends \Exception {
+
+ private $body = null;
+
+ public function __construct(\Exception $exception) {
+ $message = $exception->getMessage();
+ if($exception instanceof HttpException) {
+ $message = $exception->getResponse()->getBody()->__toString();
+ $this->body = json_decode($message, true);
+ }
+
+ parent::__construct($message, $exception->getCode(), $exception->getPrevious());
+ }
+
+ public function getBody() {
+ return $this->body;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/lib/SparkPost/SparkPostPromise.php b/lib/SparkPost/SparkPostPromise.php
new file mode 100644
index 0000000..462599a
--- /dev/null
+++ b/lib/SparkPost/SparkPostPromise.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace SparkPost;
+
+use Http\Promise\Promise as HttpPromise;
+
+class SparkPostPromise implements HttpPromise
+{
+ private $promise;
+
+ public function __construct(HttpPromise $promise) {
+ $this->promise = $promise;
+ }
+
+ public function then(callable $onFulfilled = null, callable $onRejected = null) {
+ $this->promise->then(
+ function($response) {
+ $onFulfilled(new SparkPostResponse($response));
+ },
+ function(\Exception $exception) {
+ $onRejected(new SparkPostException($exception));
+ });
+ }
+
+ public function getState() {
+ return $this->promise->getState();
+ }
+
+
+ public function wait($unwrap = true) {
+ try
+ {
+ $response = $this->promise->wait($unwrap);
+ return new SparkPostResponse($response);
+ }
+ catch (\Exception $exception)
+ {
+ throw new SparkPostException($exception);
+ }
+ }
+}
+
+?> \ No newline at end of file
diff --git a/lib/SparkPost/SparkPostResponse.php b/lib/SparkPost/SparkPostResponse.php
new file mode 100644
index 0000000..161b864
--- /dev/null
+++ b/lib/SparkPost/SparkPostResponse.php
@@ -0,0 +1,104 @@
+<?php
+
+namespace SparkPost;
+
+use Psr\Http\Message\ResponseInterface as ResponseInterface;
+use Psr\Http\Message\StreamInterface as StreamInterface;
+
+class SparkPostResponse implements ResponseInterface {
+
+ private $response;
+
+ public function __construct(ResponseInterface $response) {
+ $this->response = $response;
+ }
+
+ public function getBody()
+ {
+ $body = $this->response->getBody();
+ $body_string = $body->__toString();
+
+ if (is_string($body_string)) {
+ $json = json_decode($body_string, true);
+
+ if (json_last_error() == JSON_ERROR_NONE) {
+ return $json;
+ }
+ else {
+ return $body;
+ }
+ }
+
+ return $body;
+ }
+
+ // pass these down to the response given in the constructor
+
+ public function getProtocolVersion()
+ {
+ return $this->response->getProtocolVersion();
+ }
+
+ public function withProtocolVersion($version)
+ {
+ return $this->response->withProtocolVersion($version);
+ }
+
+ public function getHeaders()
+ {
+ return $this->response->getHeaders();
+ }
+
+ public function hasHeader($name)
+ {
+ return $this->response->hasHeader($name);
+ }
+
+ public function getHeader($name)
+ {
+ return $this->response->getHeader($name);
+ }
+
+ public function getHeaderLine($name)
+ {
+ return $this->response->getHeaderLine($name);
+ }
+
+ public function withHeader($name, $value)
+ {
+ return $this->response->withHeader($name, $value);
+ }
+
+ public function withAddedHeader($name, $value)
+ {
+ return $this->response->withAddedHeader($name, $value);
+ }
+
+ public function withoutHeader($name)
+ {
+ return $this->response->withoutHeader($name);
+ }
+
+ public function withBody(StreamInterface $body)
+ {
+ return $this->response->withBody($body);
+ }
+
+ public function getStatusCode()
+ {
+ return $this->response->getStatusCode();
+ }
+
+ public function withStatus($code, $reasonPhrase = '')
+ {
+ return $this->response->withStatus($code, $reasonPhrase);
+ }
+
+ public function getReasonPhrase()
+ {
+ $this->response->getReasonPhrase();
+ }
+
+}
+
+?> \ No newline at end of file