diff options
Diffstat (limited to 'Postman/Postman-Mail/sendgrid')
24 files changed, 1050 insertions, 400 deletions
diff --git a/Postman/Postman-Mail/sendgrid/composer.json b/Postman/Postman-Mail/sendgrid/composer.json index dbcdefd..95d93ce 100644 --- a/Postman/Postman-Mail/sendgrid/composer.json +++ b/Postman/Postman-Mail/sendgrid/composer.json @@ -1,5 +1,5 @@ { "require": { - "sendgrid/sendgrid": "~6.0" + "sendgrid/sendgrid": "~7" } -} +}
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/composer.lock b/Postman/Postman-Mail/sendgrid/composer.lock index 22d21cb..fd6a6e2 100644 --- a/Postman/Postman-Mail/sendgrid/composer.lock +++ b/Postman/Postman-Mail/sendgrid/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "72f70d0a56dace06ee80667ae9467dc2", - "content-hash": "31a416743df03ec89ce9f557ff36c18e", + "hash": "cb037c28e262c69616caad2764cb3a4f", + "content-hash": "907e285f65325b51e424d991537f18af", "packages": [ { "name": "sendgrid/php-http-client", - "version": "3.8.0", + "version": "3.9.6", "source": { "type": "git", "url": "https://github.com/sendgrid/php-http-client.git", - "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1" + "reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/929018c62b7fcd99b3b356216ae75fff4d47b5a1", - "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1", + "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/e9a04d949ee2d19938ab83dc100933a3b41a8ec7", + "reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7", "shasum": "" }, "require": { @@ -57,53 +57,64 @@ "rest", "sendgrid" ], - "time": "2017-09-13 16:52:38" + "time": "2018-04-10 18:06:08" }, { "name": "sendgrid/sendgrid", - "version": "6.0.0", + "version": "7.3.0", "source": { "type": "git", "url": "https://github.com/sendgrid/sendgrid-php.git", - "reference": "8db454e4b5674b545c207a162b64202b0d63259b" + "reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/8db454e4b5674b545c207a162b64202b0d63259b", - "reference": "8db454e4b5674b545c207a162b64202b0d63259b", + "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/37fa19d3ae019842f07a2a43e92ed0f566ad927d", + "reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d", "shasum": "" }, "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", "php": ">=5.6", - "sendgrid/php-http-client": "~3.7" + "sendgrid/php-http-client": "~3.9" }, "replace": { "sendgrid/sendgrid-php": "*" }, "require-dev": { - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "2.*" + "phpunit/phpunit": "^5.7.9 || ^6.4.3", + "squizlabs/php_codesniffer": "3.*", + "swaggest/json-diff": "^3.4" }, "type": "library", "autoload": { + "psr-4": { + "SendGrid\\": "lib/", + "SendGrid\\Mail\\": "lib/mail/", + "SendGrid\\Contacts\\": "lib/contacts/", + "SendGrid\\Stats\\": "lib/stats/" + }, "files": [ - "lib/SendGrid.php", - "lib/helpers/mail/Mail.php" + "lib/SendGrid.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "This library allows you to quickly and easily send emails through SendGrid using PHP.", + "description": "This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.", "homepage": "http://github.com/sendgrid/sendgrid-php", "keywords": [ "email", "grid", "send", - "sendgrid" + "sendgrid", + "twilio sendgrid" ], - "time": "2017-07-01 04:30:16" + "time": "2019-04-15 17:27:21" } ], "packages-dev": [], diff --git a/Postman/Postman-Mail/sendgrid/vendor/autoload.php b/Postman/Postman-Mail/sendgrid/vendor/autoload.php index cb30775..764afb2 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/autoload.php +++ b/Postman/Postman-Mail/sendgrid/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68::getLoader(); +return ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9::getLoader(); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php index c6a74bd..4d74b3d 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php @@ -7,5 +7,4 @@ $baseDir = dirname($vendorDir); return array( '3f8bdd3b35094c73a26f0106e3c0f8b2' => $vendorDir . '/sendgrid/sendgrid/lib/SendGrid.php', - '9dda55337a76a24e949fbcc5d905a2c7' => $vendorDir . '/sendgrid/sendgrid/lib/helpers/mail/Mail.php', ); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php index 89751b9..7618d79 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php @@ -6,5 +6,8 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'SendGrid\\' => array($vendorDir . '/sendgrid/php-http-client/lib'), + 'SendGrid\\Stats\\' => array($vendorDir . '/sendgrid/sendgrid/lib/stats'), + 'SendGrid\\Mail\\' => array($vendorDir . '/sendgrid/sendgrid/lib/mail'), + 'SendGrid\\Contacts\\' => array($vendorDir . '/sendgrid/sendgrid/lib/contacts'), + 'SendGrid\\' => array($vendorDir . '/sendgrid/php-http-client/lib', $vendorDir . '/sendgrid/sendgrid/lib'), ); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php index 81518bf..35b4612 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68 +class ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9 { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -42,14 +42,14 @@ class ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68 $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire31a2dc55ed2dc338fb6b79b1af891c68($fileIdentifier, $file); + composerRequireb8261ccd2bb9e98223bcd166b46db8d9($fileIdentifier, $file); } return $loader; } } -function composerRequire31a2dc55ed2dc338fb6b79b1af891c68($fileIdentifier, $file) +function composerRequireb8261ccd2bb9e98223bcd166b46db8d9($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json b/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json index b3d9001..f86362a 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json @@ -1,17 +1,17 @@ [ { "name": "sendgrid/php-http-client", - "version": "3.8.0", - "version_normalized": "3.8.0.0", + "version": "3.9.6", + "version_normalized": "3.9.6.0", "source": { "type": "git", "url": "https://github.com/sendgrid/php-http-client.git", - "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1" + "reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/929018c62b7fcd99b3b356216ae75fff4d47b5a1", - "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1", + "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/e9a04d949ee2d19938ab83dc100933a3b41a8ec7", + "reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7", "shasum": "" }, "require": { @@ -21,7 +21,7 @@ "phpunit/phpunit": "~4.4", "squizlabs/php_codesniffer": "~2.0" }, - "time": "2017-09-13 16:52:38", + "time": "2018-04-10 18:06:08", "type": "library", "installation-source": "dist", "autoload": { @@ -55,50 +55,61 @@ }, { "name": "sendgrid/sendgrid", - "version": "6.0.0", - "version_normalized": "6.0.0.0", + "version": "7.3.0", + "version_normalized": "7.3.0.0", "source": { "type": "git", "url": "https://github.com/sendgrid/sendgrid-php.git", - "reference": "8db454e4b5674b545c207a162b64202b0d63259b" + "reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/8db454e4b5674b545c207a162b64202b0d63259b", - "reference": "8db454e4b5674b545c207a162b64202b0d63259b", + "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/37fa19d3ae019842f07a2a43e92ed0f566ad927d", + "reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d", "shasum": "" }, "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", "php": ">=5.6", - "sendgrid/php-http-client": "~3.7" + "sendgrid/php-http-client": "~3.9" }, "replace": { "sendgrid/sendgrid-php": "*" }, "require-dev": { - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "2.*" + "phpunit/phpunit": "^5.7.9 || ^6.4.3", + "squizlabs/php_codesniffer": "3.*", + "swaggest/json-diff": "^3.4" }, - "time": "2017-07-01 04:30:16", + "time": "2019-04-15 17:27:21", "type": "library", "installation-source": "dist", "autoload": { + "psr-4": { + "SendGrid\\": "lib/", + "SendGrid\\Mail\\": "lib/mail/", + "SendGrid\\Contacts\\": "lib/contacts/", + "SendGrid\\Stats\\": "lib/stats/" + }, "files": [ - "lib/SendGrid.php", - "lib/helpers/mail/Mail.php" + "lib/SendGrid.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "This library allows you to quickly and easily send emails through SendGrid using PHP.", + "description": "This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.", "homepage": "http://github.com/sendgrid/sendgrid-php", "keywords": [ "email", "grid", "send", - "sendgrid" + "sendgrid", + "twilio sendgrid" ] } ] diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE index f6eac95..94a2122 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE @@ -14,4 +14,4 @@ Any other information you want to share that is relevant to the issue being repo #### Technical details: * php-http-client Version: master (latest commit: [commit number]) -* PHP Version: 5.x +* PHP Version: X.X diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore index bc9ed87..b90ffc5 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore @@ -1,6 +1,11 @@ -.env -*.lock +# Composer vendor/ +*.phar +*.lock + +# Jetbrains Idea *.old .idea/ -*.phar + +# Environment files +.env/*.*
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml index c9ad9ca..0ba5d28 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml @@ -3,7 +3,9 @@ before_script: - composer install --dev --no-interaction - cd test/unit script: -- ../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* --coverage-clover clover.xml +- ../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* --coverage-clover=coverage.xml +after_success: +- bash <(curl -s https://codecov.io/bash) php: - 5.6 - 7.0 @@ -22,4 +24,4 @@ notifications: Build %{build_number}</a> on branch <i>%{branch}</i> by %{author}: <strong>%{message}</strong> <a href="https://github.com/%{repository}/commits/%{commit}">View on GitHub</a>' format: html - notify: true
\ No newline at end of file + notify: true diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md index fb45f8d..dd0c13d 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md @@ -3,6 +3,72 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [3.9.6] - 2018-04-10 +### Added +- PR [#98](https://github.com/sendgrid/php-http-client/pull/98). Updated documention of `Client.php` using PHPDoc. +- Thanks to [Martijn Melchers](https://github.com/martijnmelchers) for the pull request! + +## [3.9.5] - 2018-03-26 +### Added +- Fixes [#94](https://github.com/sendgrid/php-http-client/issues/94), PR [#95](https://github.com/sendgrid/php-http-client/pull/95): CreateCurlOptions method regression tests +- Thanks to [Alexandr Ivanov](https://github.com/misantron) for the pull request! + +## [3.9.4] - 2018-03-22 +### Fixed +- Fixes [#586](https://github.com/sendgrid/sendgrid-php/issues/586), PR [#96](https://github.com/sendgrid/php-http-client/pull/96): Fix constructor function signature regression. + +## [3.9.3] - 2018-03-11 +### Fixed +- Fixes [#584](https://github.com/sendgrid/sendgrid-php/issues/584), PR [#93](https://github.com/sendgrid/php-http-client/pull/93): Don't overwrite headers set from upstream dependencies. + +## [3.9.2] - 2018-03-10 +### Fixed +- Fixes [#12](https://github.com/sendgrid/php-http-client/issues/12), PR [#91](https://github.com/sendgrid/php-http-client/pull/91): Curl Options broken as array merge does not preserve keys. + +## [3.9.1] - 2018-03-09 +### Fixed +- Fixes [#88](https://github.com/sendgrid/php-http-client/issues/88), PR [#89](https://github.com/sendgrid/php-http-client/pull/89): Restore missing function 'prepareResponse' due to bad previous merge. + +## [3.9.0] - 2018-03-08 +### Added +- PR [#24](https://github.com/sendgrid/php-http-client/pull/24): implements sending concurrent requests with curl multi, thanks to [Tuan Nguyen](https://github.com/lightbringer1991) for the PR! +- PR [#25](https://github.com/sendgrid/php-http-client/pull/25): Add description how install php-http-client manually, thanks to [Ivan](https://github.com/janczer) for the PR! +- PR [#28](https://github.com/sendgrid/php-http-client/pull/28): Create code of conduct, thanks to [Alexander Androsyuk](https://github.com/alex2sat) for the PR! +- Closes [#32](https://github.com/sendgrid/php-http-client/issues/32), PR [#33](https://github.com/sendgrid/php-http-client/pull/33): Added TROUBLESHOOTING + Debug Info, thanks to [Braunson Yager](https://github.com/Braunson) for the PR! +- Closes [#35](https://github.com/sendgrid/php-http-client/issues/35), PR [#37](https://github.com/sendgrid/php-http-client/pull/37): Update README badges, thanks to [Tim Harshman](https://github.com/goteamtim) for the PR! +- Closes [#34](https://github.com/sendgrid/php-http-client/issues/34), PR [#38](https://github.com/sendgrid/php-http-client/pull/38): Update .md files with hyphen vs underscore for page links to enhance SEO, thanks to [Eric Kates](https://github.com/positronek) for the PR! +- Closes [#39](https://github.com/sendgrid/php-http-client/issues/39), PR [#40](https://github.com/sendgrid/php-http-client/pull/40): Added Packagist badge to README, thanks to [Rakshan Shetty](https://github.com/rakshans1) for the PR! +- PR [#41](https://github.com/sendgrid/php-http-client/pull/41): Add table of contents in README.md, thanks to [thepriefy](https://github.com/thepriefy) for the PR! +- PR [#42](https://github.com/sendgrid/php-http-client/pull/42): Add SendGrid logo at the top of README.md, thanks to [thepriefy](https://github.com/thepriefy) for the PR! +- PR [#43](https://github.com/sendgrid/php-http-client/pull/43): Add License section to the README.md, thanks to [thepriefy](https://github.com/thepriefy) for the PR! +- Closes [#46](https://github.com/sendgrid/php-http-client/issues/46), PR [#47](https://github.com/sendgrid/php-http-client/pull/47): Create Pull Request Template, thanks to [Paweł Lewtak](https://github.com/pawel-lewtak) for the PR! +- Closes [#48](https://github.com/sendgrid/php-http-client/issues/48), PR [#51](https://github.com/sendgrid/php-http-client/pull/51): Added example file, updated .gitignore and README, thanks to [Diego Rocha](https://github.com/dhsrocha) for the PR! +- PR [#53](https://github.com/sendgrid/php-http-client/pull/53): README and usage example update, thanks to [Alexandr Ivanov](https://github.com/misantron) for the PR! +- PR [#55](https://github.com/sendgrid/php-http-client/pull/55): Code climate config, thanks to [Alexandr Ivanov](https://github.com/misantron) for the PR! +- Closes [#58](https://github.com/sendgrid/php-http-client/pull/58), PR [#60](https://github.com/sendgrid/php-http-client/pull/60): Adds unit test for checking file existence in repo, thanks to [Michele Orselli](https://github.com/micheleorselli) for the PR! +- Closes [#57](https://github.com/sendgrid/php-http-client/pull/57), PR [#61](https://github.com/sendgrid/php-http-client/pull/61): Adds unit test for checking year on licence, thanks to [Michele Orselli](https://github.com/micheleorselli) for the PR! +- Closes [#50](https://github.com/sendgrid/php-http-client/issues/50), PR [#62](https://github.com/sendgrid/php-http-client/pull/62): Create USAGE.md, thanks to [Nitanshu](https://github.com/nvzard) for the PR! +- Closes [#57](https://github.com/sendgrid/php-http-client/issues/57), PR [#66](https://github.com/sendgrid/php-http-client/pull/66): Add unit test for license year, thanks to [Alex](https://github.com/pushkyn) for the PR! +- Closes [#67](https://github.com/sendgrid/php-http-client/issues/67), PR [#68](https://github.com/sendgrid/php-http-client/pull/68): Add CodeCov support to .travis.yml, thanks to [Manjiri Tapaswi](https://github.com/mptap) for the PR! +- Closes [#49](https://github.com/sendgrid/php-http-client/issues/49), PR [#73](https://github.com/sendgrid/php-http-client/pull/73): Create Dockerfile, thanks to [Jessica Mauerhan](https://github.com/jmauerhan) for the PR! +- Closes [#76](https://github.com/sendgrid/php-http-client/issues/76), PR [#78](https://github.com/sendgrid/php-http-client/pull/78): Added Pull Requests Review section to CONTRIBUTE.md Closes, thanks to [Povilas Balzaravičius](https://github.com/Pawka) for the PR! +- Closes [#63](https://github.com/sendgrid/php-http-client/issues/63), PR [#79](https://github.com/sendgrid/php-http-client/pull/79): Refactor makeRequest method, thanks to [Michael Dennis](https://github.com/michaeljdennis) for the PR! +- PR [#82](https://github.com/sendgrid/php-http-client/pull/82): Add JsonSerializable type to phpDoc of $body parameter in makeRequest method, thanks to [Jan Konáš](https://github.com/jankonas) for the PR! +- PR [#85](https://github.com/sendgrid/php-http-client/pull/85): Updated the PHP Version details, thanks to [Siddhant Sharma](https://github.com/ssiddhantsharma) for the PR! +- PR [#86](https://github.com/sendgrid/php-http-client/pull/86): Add phpdoc for send method, thanks to [Vitaliy Ryaboy](https://github.com/rvitaliy) for the PR! +- PR [#84](https://github.com/sendgrid/php-http-client/pull/84): Update Docker instructions + + +### Fixed +- PR [#26](https://github.com/sendgrid/php-http-client/pull/26): README typo, thanks to [Cícero Pablo](https://github.com/ciceropablo) for the PR! +- PR [#30](https://github.com/sendgrid/php-http-client/pull/30), Fixes [#18](https://github.com/sendgrid/php-http-client/issues/18): Disable CURLOPT_FAILONERROR, thanks to [Zsolt Prontvai](https://github.com/ProZsolt) for the PR! +- PR [#44](https://github.com/sendgrid/php-http-client/pull/44): Fix Typo and add missing links to README, thanks to [Alex](https://github.com/pushkyn) for the PR! +- PR [#52](https://github.com/sendgrid/php-http-client/pull/52): Fix syntax errors in README examples, thanks to [Michael Spiss](https://github.com/michaelspiss) for the PR! +- Fixes [#56](https://github.com/sendgrid/php-http-client/pull/56), PR [#59](https://github.com/sendgrid/php-http-client/pull/59): Update LICENSE - fix year, thanks to [Alex](https://github.com/pushkyn) for the PR! +- PR [#69](https://github.com/sendgrid/php-http-client/pull/69): Remove extra parenthesis from README, thanks to [Jessica Mauerhan](https://github.com/jmauerhan) for the PR! +- PR [#71](https://github.com/sendgrid/php-http-client/pull/71): Fix typo in CONTRIBUTING.md, thanks to [thepriefy](https://github.com/thepriefy) for the PR! +- Fixes [#81](https://github.com/sendgrid/php-http-client/issues/81), PR [#87](https://github.com/sendgrid/php-http-client/pull/87): Stop using insecure option by default + ## [3.8.0] - 2017-09-13 ### Added - Pull request #23: [Automatically retry when rate limit is reached](https://github.com/sendgrid/php-http-client/pull/23) diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md index 6350054..6b01be8 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md @@ -2,13 +2,14 @@ Hello! Thank you for choosing to help contribute to one of the SendGrid open sou - [CLAs and CCLAs](#cla) - [Roadmap & Milestones](#roadmap) -- [Feature Request](#feature_request) -- [Submit a Bug Report](#submit_a_bug_report) -- [Improvements to the Codebase](#improvements_to_the_codebase) -- [Understanding the Code Base](#understanding_the_codebase) +- [Feature Request](#feature-request) +- [Submit a Bug Report](#submit-a-bug-report) +- [Improvements to the Codebase](#improvements-to-the-codebase) +- [Understanding the Code Base](#understanding-the-codebase) - [Testing](#testing) -- [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions) -- [Creating a Pull Request](#creating_a_pull_request) +- [Style Guidelines & Naming Conventions](#style-guidelines-and-naming-conventions) +- [Creating a Pull Request](#creating-a-pull-request) +- [Code Reviews](#code-reviews) <a name="roadmap"></a> We use [Milestones](https://github.com/sendgrid/php-http-client/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged. @@ -26,7 +27,7 @@ When you create a Pull Request, after a few seconds, a comment will appear with There are a few ways to contribute, which we'll enumerate below: -<a name="feature_request"></a> +<a name="feature-request"></a> ## Feature Request If you'd like to make a feature request, please read this section. @@ -36,7 +37,7 @@ The GitHub issue tracker is the preferred channel for library feature requests, - Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests. - Please be respectful and considerate of others when commenting on issues -<a name="submit_a_bug_report"></a> +<a name="submit-a-bug-report"></a> ## Submit a Bug Report Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public. @@ -53,7 +54,7 @@ Before you decide to create a new issue, please try the following: In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/php-http-client/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting. -<a name="improvements_to_the_codebase"></a> +<a name="improvements-to-the-codebase"></a> ## Improvements to the Codebase We welcome direct contributions to the php-http-client code base. Thank you! @@ -74,7 +75,7 @@ git clone https://github.com/sendgrid/php-http-client.git cd php-http-client ``` -## Environment Variables +### Environment Variables First, get your free SendGrid account [here](https://sendgrid.com/free?source=php-http-client). @@ -88,8 +89,9 @@ source ./sendgrid.env ##### Execute: ##### -See the [examples folder](https://github.com/sendgrid/php-http-client/tree/master/examples -<a name="understanding_the_codebase"></a> +See the [examples folder](https://github.com/sendgrid/php-http-client/tree/master/examples). + +<a name="understanding-the-codebase"></a> ## Understanding the Code Base **/examples** @@ -127,7 +129,7 @@ cd test/unit ../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* ``` -<a name="style_guidelines_and_naming_conventions"></a> +<a name="style-guidelines-and-naming-conventions"></a> ## Style Guidelines & Naming Conventions Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning. @@ -138,7 +140,8 @@ Please run your code through: - [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) -## Creating a Pull Request<a name="creating_a_pull_request"></a> +<a name="creating-a-pull-request"></a> +## Creating a Pull Request 1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork, and configure the remotes: @@ -147,7 +150,7 @@ Please run your code through: # Clone your fork of the repo into the current directory git clone https://github.com/sendgrid/php-http-client # Navigate to the newly cloned directory - cd sendgrid-python + cd php-http-client # Assign the original repo to a remote called "upstream" git remote add upstream https://github.com/sendgrid/php-http-client ``` @@ -191,4 +194,8 @@ Please run your code through: 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description against the `master` branch. All tests must be passing before we will review the PR. +<a name="code-reviews"></a> +## Code Reviews +If you can, please look at open PRs and review them. Give feedback and help us merge these PRs much faster! If you don't know how, Github has some great [information on how to review a Pull Request](https://help.github.com/articles/about-pull-request-reviews/). + If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo. diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt index c1631d6..8a3ef00 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 SendGrid, Inc. +Copyright (c) 2012-2018 SendGrid, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md index 0eb7ce8..ef7236a 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md @@ -1,4 +1,11 @@ +![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png) + [![Travis Badge](https://travis-ci.org/sendgrid/php-http-client.svg?branch=master)](https://travis-ci.org/sendgrid/php-http-client) +[![Latest Version on Packagist](https://img.shields.io/packagist/v/sendgrid/php-http-client.svg?style=flat-square)](https://packagist.org/packages/sendgrid/php-http-client) +[![Email Notifications Badge](https://dx.sendgrid.com/badge/php)](https://dx.sendgrid.com/newsletter/php) +[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid) +[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/php-http-client.svg)](https://github.com/sendgrid/php-http-client/graphs/contributors) +[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt) **Quickly and easily access any RESTful or RESTful-like API.** @@ -8,6 +15,17 @@ If you are looking for the SendGrid API client library, please see [this repo](h All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/php-http-client/blob/master/CHANGELOG.md). +# Table of Contents +- [Installation](#installation) +- [Quick Start](#quick-start) +- [Usage](#usage) +- [Roadmap](#roadmap) +- [How to Contribute](#contribute) +- [Thanks](#thanks) +- [About](#about) +- [License](#license) + +<a name="installation"></a> # Installation ## Prerequisites @@ -21,7 +39,7 @@ Add php-http-client to your `composer.json` file. If you are not using [Composer ```json { "require": { - "sendgrid/php-http-client": "~3.8" + "sendgrid/php-http-client": "~3.9.6" } } ``` @@ -38,6 +56,44 @@ Then from the command line: composer install ``` +## Install without Composer + +You should create directory `lib` in directory of your application and clone to `lib` repositories [php-http-client](https://github.com/sendgrid/php-http-client.git) and [sendgrid-php](https://github.com/sendgrid/sendgrid-php.git): + +``` +$ cd /path/to/your/app +$ mkdir lib +$ cd lib +$ git clone https://github.com/sendgrid/php-http-client.git +``` + +In the next step you should create `loader.php`: + +``` +$ cd /path/to/your/app +$ touch loader.php +``` + +And add to `loader.php` code below: + +```php +<?php + +require_once __DIR__ . '/lib/php-http-client/lib/Client.php'; +require_once __DIR__ . '/lib/php-http-client/lib/Response.php'; +``` + +After it you can use `php-http-client` library in your project: + +```php +<?php + +include __DIR__ . '/loader.php'; + +$client = new SendGrid\Client(); +``` + +<a name="quick-start"></a> # Quick Start Here is a quick example: @@ -45,59 +101,95 @@ Here is a quick example: `GET /your/api/{param}/call` ```php +// include __DIR__ . '/loader.php'; require 'vendor/autoload.php'; -$global_headers = array(Authorization: Basic XXXXXXX); -$client = SendGrid\Client('base_url', global_headers); +$apiKey = YOUR_SENDGRID_API_KEY; +$authHeaders = [ + 'Authorization: Bearer ' . $apiKey +]; +$client = new SendGrid\Client('https://api.sendgrid.com', $authHeaders); +$param = 'foo'; $response = $client->your()->api()->_($param)->call()->get(); -print $response->statusCode(); -print $response->headers(); -print $response->body(); + +var_dump( + $response->statusCode(), + $response->headers(), + $response->body() +); ``` `POST /your/api/{param}/call` with headers, query parameters and a request body with versioning. ```php +// include __DIR__ . '/loader.php'; require 'vendor/autoload.php'; -$global_headers = array(Authorization: Basic XXXXXXX); -$client = SendGrid\Client('base_url', global_headers); -$query_params = array('hello' => 0, 'world' => 1); -$request_headers = array('X-Test' => 'test'); -$data = array('some' => 1, 'awesome' => 2, 'data' => 3); -$response = $client->your()->api()->_($param)->call()->post('data', - 'query_params', - 'request_headers'); -print $response->statusCode(); -print $response->headers(); -print $response->body(); +$apiKey = YOUR_SENDGRID_API_KEY; +$authHeaders = [ + 'Authorization: Bearer ' . $apiKey +]; +$client = new SendGrid\Client('https://api.sendgrid.com', $authHeaders); +$queryParams = [ + 'hello' => 0, 'world' => 1 +]; +$requestHeaders = [ + 'X-Test' => 'test' +]; +$data = [ + 'some' => 1, 'awesome' => 2, 'data' => 3 +]; +$param = 'bar'; +$response = $client->your()->api()->_($param)->call()->post($data, $queryParams, $requestHeaders); + +var_dump( + $response->statusCode(), + $response->headers(), + $response->body() +); ``` +<a name="usage"></a> # Usage -- [Example Code](https://github.com/sendgrid/php-http-client/tree/master/examples) +- [Usage Examples](USAGE.md) + +## Environment Variables + +You can do the following to create a .env file: -## Roadmap +```cp .env_example .env``` -If you are intersted in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/php-http-client/milestones). We would love to hear your feedback. +Then, just add your API Key into your .env file. -## How to Contribute +<a name="roadmap"></a> +# Roadmap -We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md)) guide for details. +If you are interested in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/php-http-client/milestones). We would love to hear your feedback. + +<a name="contribute"></a> +# How to Contribute + +We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md) guide for details. Quick links: -- [Feature Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#feature_request) -- [Bug Reports](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#submit_a_bug_report) +- [Feature Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#feature-request) +- [Bug Reports](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#submit-a-bug-report) - [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#cla) -- [Improvements to the Codebase](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#improvements_to_the_codebase) +- [Improvements to the Codebase](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#improvements-to-the-codebase) +- [Review Pull Requests](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#code-reviews) +<a name="thanks"></a> # Thanks We were inspired by the work done on [birdy](https://github.com/inueni/birdy) and [universalclient](https://github.com/dgreisen/universalclient). +<a name="about"></a> # About php-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com). php-http-client is maintained and funded by SendGrid, Inc. The names and logos for php-http-client are trademarks of SendGrid, Inc. -![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png) +<a name="license"></a> +# License +[The MIT License (MIT)](LICENSE.txt) diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json index 80b219b..5c0a3af 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json @@ -2,11 +2,7 @@ "name": "sendgrid/php-http-client", "description": "HTTP REST client, simplified for PHP", "type": "library", - "version": "3.8.0", - "require-dev": { - "phpunit/phpunit": "~4.4", - "squizlabs/php_codesniffer": "~2.0" - }, + "version": "3.9.6", "homepage": "http://github.com/sendgrid/php-http-client", "keywords": ["SendGrid", "HTTP", "REST", "API", "Fluent"], "license": "MIT", @@ -23,6 +19,10 @@ "require": { "php": ">=5.6" }, + "require-dev": { + "phpunit/phpunit": "~4.4", + "squizlabs/php_codesniffer": "~2.0" + }, "autoload": { "psr-4": { "SendGrid\\": "lib/" diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php index d3ca94d..ec732b9 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php @@ -1,46 +1,225 @@ <?php /** - * HTTP Client library - * - * PHP version 5.4 - * - * @author Matt Bernier <dx@sendgrid.com> - * @author Elmer Thomas <dx@sendgrid.com> - * @copyright 2016 SendGrid - * @license https://opensource.org/licenses/MIT The MIT License - * @version GIT: <git_id> - * @link http://packagist.org/packages/sendgrid/php-http-client - */ + * HTTP Client library + * + * @author Matt Bernier <dx@sendgrid.com> + * @author Elmer Thomas <dx@sendgrid.com> + * @copyright 2018 SendGrid + * @license https://opensource.org/licenses/MIT The MIT License + * @version GIT: <git_id> + * @link http://packagist.org/packages/sendgrid/php-http-client + */ namespace SendGrid; /** - * Quickly and easily access any REST or REST-like API. - */ + * + * Class Client + * @package SendGrid + * @version 3.9.5 + * + * Quickly and easily access any REST or REST-like API. + * + * @method Response get($body = null, $query = null, $headers = null) + * @method Response post($body = null, $query = null, $headers = null) + * @method Response patch($body = null, $query = null, $headers = null) + * @method Response put($body = null, $query = null, $headers = null) + * @method Response delete($body = null, $query = null, $headers = null) + * + * @method Client version($value) + * @method Client|Response send() + * + * Adding all the endpoints as a method so code completion works + * + * General + * @method Client stats() + * @method Client search() + * @method Client monthly() + * @method Client sums() + * @method Client monitor() + * @method Client test() + * + * Access settings + * @method Client access_settings() + * @method Client activity() + * @method Client whitelist() + * + * Alerts + * @method Client alerts() + * + * Api keys + * @method Client api_keys() + * + * ASM + * @method Client asm() + * @method Client groups() + * + * Browsers + * @method Client browsers() + * + * Campaigns + * @method Client campaigns() + * @method Client schedules() + * @method Client now() + * + * Categories + * @method Client categories() + * + * Clients + * @method Client clients() + * + * ContactDB + * @method Client contactdb() + * @method Client custom_fields() + * @method Client lists() + * @method Client recipients() + * @method Client billable_count() + * @method Client count() + * @method Client reserved_fields() + * @method Client segments() + * + * Devices + * @method Client devices() + * + * Geo + * @method Client geo() + * + * Ips + * @method Client ips() + * @method Client assigned() + * @method Client pools() + * @method Client warmup() + * + * Mail + * @method Client mail() + * @method Client batch() + * + * Mailbox Providers + * @method Client mailbox_providers() + * + * Mail settings + * @method Client mail_settings() + * @method Client address_whitelist() + * @method Client bcc() + * @method Client bounce_purge() + * @method Client footer() + * @method Client forward_bounce() + * @method Client forward_spam() + * @method Client plain_content() + * @method Client spam_check() + * @method Client template() + * + * Partner settings + * @method Client partner_settings() + * @method Client new_relic() + * + * Scopes + * @method Client scopes() + * + * Senders + * @method Client senders() + * @method Client resend_verification() + * + * Sub Users + * @method Client subusers() + * @method Client reputations() + * + * Supressions + * @method Client suppressions() + * @method Client global() + * @method Client blocks() + * @method Client bounces() + * @method Client invalid_emails() + * @method Client spam_reports() + * @method Client unsubcribes() + * + * Templates + * @method Client templates() + * @method Client versions() + * @method Client activate() + * + * Tracking settings + * @method Client tracking_settings() + * @method Client click() + * @method Client google_analytics() + * @method Client open() + * @method Client subscription() + * + * User + * @method Client user() + * @method Client account() + * @method Client credits() + * @method Client email() + * @method Client password() + * @method Client profile() + * @method Client scheduled_sends() + * @method Client enforced_tls() + * @method Client settings() + * @method Client username() + * @method Client webhooks() + * @method Client event() + * @method Client parse() + * + * Missed any? Simply add them by doing: @method Client method() + */ class Client { - /** @var string */ + const TOO_MANY_REQUESTS_HTTP_CODE = 429; + + /** + * @var string + */ protected $host; - /** @var array */ + + /** + * @var array + */ protected $headers; - /** @var string */ + + /** + * @var string + */ protected $version; - /** @var array */ + + /** + * @var array + */ protected $path; - /** @var array */ + + /** + * @var array + */ protected $curlOptions; - /** @var array */ - private $methods; - /** @var bool */ - private $retryOnLimit; + + /** + * @var bool + */ + protected $isConcurrentRequest; + + /** + * @var array + */ + protected $savedRequests; + + /** + * @var bool + */ + protected $retryOnLimit; + + /** + * These are the supported HTTP verbs + * + * @var array + */ + private $methods = ['get', 'post', 'patch', 'put', 'delete']; /** * Initialize the client * * @param string $host the base url (e.g. https://api.sendgrid.com) * @param array $headers global request headers - * @param string $version api version (configurable) + * @param string $version api version (configurable) - this is specific to the SendGrid API * @param array $path holds the segments of the url path * @param array $curlOptions extra options to set during curl initialization * @param bool $retryOnLimit set default retry on limit flag @@ -52,10 +231,9 @@ class Client $this->version = $version; $this->path = $path ?: []; $this->curlOptions = $curlOptions ?: []; - // These are the supported HTTP verbs - $this->methods = ['delete', 'get', 'patch', 'post', 'put']; - $this->retryOnLimit = $retryOnLimit; + $this->isConcurrentRequest = false; + $this->savedRequests = []; } /** @@ -99,29 +277,54 @@ class Client } /** - * Make a new Client object - * - * @param string $name name of the url segment - * - * @return Client object - */ - private function buildClient($name = null) + * Set extra options to set during curl initialization + * + * @param array $options + * + * @return Client + */ + public function setCurlOptions(array $options) { - if (isset($name)) { - $this->path[] = $name; - } - $client = new Client($this->host, $this->headers, $this->version, $this->path, $this->curlOptions); - $this->path = []; - return $client; + $this->curlOptions = $options; + + return $this; } /** - * Build the final URL to be passed - * - * @param array $queryParams an array of all the query parameters - * - * @return string - */ + * Set default retry on limit flag + * + * @param bool $retry + * + * @return Client + */ + public function setRetryOnLimit($retry) + { + $this->retryOnLimit = $retry; + + return $this; + } + + /** + * Set concurrent request flag + * + * @param bool $isConcurrent + * + * @return Client + */ + public function setIsConcurrentRequest($isConcurrent) + { + $this->isConcurrentRequest = $isConcurrent; + + return $this; + } + + /** + * Build the final URL to be passed + * + * @param array $queryParams an array of all the query parameters + * + * @return string + */ private function buildUrl($queryParams = null) { $path = '/' . implode('/', $this->path); @@ -132,86 +335,231 @@ class Client } /** - * Make the API call and return the response. This is separated into - * it's own function, so we can mock it easily for testing. - * - * @param string $method the HTTP verb - * @param string $url the final url to call - * @param array $body request body - * @param array $headers any additional request headers - * @param bool $retryOnLimit should retry if rate limit is reach? - * - * @return Response object - */ - public function makeRequest($method, $url, $body = null, $headers = null, $retryOnLimit = false) + * Creates curl options for a request + * this function does not mutate any private variables + * + * @param string $method + * @param array $body + * @param array $headers + * + * @return array + */ + private function createCurlOptions($method, $body = null, $headers = null) { - $curl = curl_init($url); - - curl_setopt_array($curl, [ - CURLOPT_RETURNTRANSFER => true, - CURLOPT_HEADER => 1, - CURLOPT_CUSTOMREQUEST => strtoupper($method), - CURLOPT_SSL_VERIFYPEER => false, - ] + $this->curlOptions); + $options = [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => true, + CURLOPT_CUSTOMREQUEST => strtoupper($method), + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_FAILONERROR => false + ] + $this->curlOptions; if (isset($headers)) { - $this->headers = array_merge($this->headers, $headers); + $headers = array_merge($this->headers, $headers); + } else { + $headers = $this->headers; } + if (isset($body)) { $encodedBody = json_encode($body); - curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedBody); - $this->headers = array_merge($this->headers, ['Content-Type: application/json']); + $options[CURLOPT_POSTFIELDS] = $encodedBody; + $headers = array_merge($headers, ['Content-Type: application/json']); + } + $options[CURLOPT_HTTPHEADER] = $headers; + + return $options; + } + + /** + * @param array $requestData + * e.g. ['method' => 'POST', 'url' => 'www.example.com', 'body' => 'test body', 'headers' => []] + * @param bool $retryOnLimit + * + * @return array + */ + private function createSavedRequest(array $requestData, $retryOnLimit = false) + { + return array_merge($requestData, ['retryOnLimit' => $retryOnLimit]); + } + + /** + * @param array $requests + * + * @return array + */ + private function createCurlMultiHandle(array $requests) + { + $channels = []; + $multiHandle = curl_multi_init(); + + foreach ($requests as $id => $data) { + $channels[$id] = curl_init($data['url']); + $curlOpts = $this->createCurlOptions($data['method'], $data['body'], $data['headers']); + curl_setopt_array($channels[$id], $curlOpts); + curl_multi_add_handle($multiHandle, $channels[$id]); } - curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers); - $response = curl_exec($curl); - $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); - $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + return [$channels, $multiHandle]; + } + + /** + * Prepare response object + * + * @param resource $channel the curl resource + * @param string $content + * + * @return Response object + */ + private function parseResponse($channel, $content) + { + $headerSize = curl_getinfo($channel, CURLINFO_HEADER_SIZE); + $statusCode = curl_getinfo($channel, CURLINFO_HTTP_CODE); - $responseBody = substr($response, $headerSize); - $responseHeaders = substr($response, 0, $headerSize); + $responseBody = substr($content, $headerSize); + $responseHeaders = substr($content, 0, $headerSize); $responseHeaders = explode("\n", $responseHeaders); $responseHeaders = array_map('trim', $responseHeaders); - curl_close($curl); - - $response = new Response($statusCode, $responseBody, $responseHeaders); + return new Response($statusCode, $responseBody, $responseHeaders); + } - if ($statusCode == 429 && $retryOnLimit) { - $headers = $response->headers(true); - $sleepDurations = $headers['X-Ratelimit-Reset'] - time(); - sleep($sleepDurations > 0 ? $sleepDurations : 0); - return $this->makeRequest($method, $url, $body, $headers, false); + /** + * Retry request + * + * @param array $responseHeaders headers from rate limited response + * @param string $method the HTTP verb + * @param string $url the final url to call + * @param array $body request body + * @param array $headers original headers + * + * @return Response response object + */ + private function retryRequest(array $responseHeaders, $method, $url, $body, $headers) + { + $sleepDurations = $responseHeaders['X-Ratelimit-Reset'] - time(); + sleep($sleepDurations > 0 ? $sleepDurations : 0); + return $this->makeRequest($method, $url, $body, $headers, false); + } + + /** + * Make the API call and return the response. + * This is separated into it's own function, so we can mock it easily for testing. + * + * @param string $method the HTTP verb + * @param string $url the final url to call + * @param array $body request body + * @param array $headers any additional request headers + * @param bool $retryOnLimit should retry if rate limit is reach? + * + * @return Response object + */ + public function makeRequest($method, $url, $body = null, $headers = null, $retryOnLimit = false) + { + $channel = curl_init($url); + + $options = $this->createCurlOptions($method, $body, $headers); + + curl_setopt_array($channel, $options); + $content = curl_exec($channel); + + $response = $this->parseResponse($channel, $content); + + if ($response->statusCode() === self::TOO_MANY_REQUESTS_HTTP_CODE && $retryOnLimit) { + $responseHeaders = $response->headers(true); + return $this->retryRequest($responseHeaders, $method, $url, $body, $headers); } + curl_close($channel); + return $response; } /** - * Add variable values to the url. - * (e.g. /your/api/{variable_value}/call) - * Another example: if you have a PHP reserved word, such as and, - * in your url, you must use this method. - * - * @param string $name name of the url segment - * - * @return Client object - */ + * Send all saved requests at once + * + * @param array $requests + * + * @return Response[] + */ + public function makeAllRequests(array $requests = []) + { + if (empty($requests)) { + $requests = $this->savedRequests; + } + list($channels, $multiHandle) = $this->createCurlMultiHandle($requests); + + // running all requests + $isRunning = null; + do { + curl_multi_exec($multiHandle, $isRunning); + } while ($isRunning); + + // get response and close all handles + $retryRequests = []; + $responses = []; + $sleepDurations = 0; + foreach ($channels as $id => $channel) { + + $content = curl_multi_getcontent($channel); + $response = $this->parseResponse($channel, $content); + + if ($response->statusCode() === self::TOO_MANY_REQUESTS_HTTP_CODE && $requests[$id]['retryOnLimit']) { + $headers = $response->headers(true); + $sleepDurations = max($sleepDurations, $headers['X-Ratelimit-Reset'] - time()); + $requestData = [ + 'method' => $requests[$id]['method'], + 'url' => $requests[$id]['url'], + 'body' => $requests[$id]['body'], + 'headers' => $headers, + ]; + $retryRequests[] = $this->createSavedRequest($requestData, false); + } else { + $responses[] = $response; + } + + curl_multi_remove_handle($multiHandle, $channel); + } + curl_multi_close($multiHandle); + + // retry requests + if (!empty($retryRequests)) { + sleep($sleepDurations > 0 ? $sleepDurations : 0); + $responses = array_merge($responses, $this->makeAllRequests($retryRequests)); + } + return $responses; + } + + /** + * Add variable values to the url. (e.g. /your/api/{variable_value}/call) + * Another example: if you have a PHP reserved word, such as and, in your url, you must use this method. + * + * @param string $name name of the url segment + * + * @return Client object + */ public function _($name = null) { - return $this->buildClient($name); + if (isset($name)) { + $this->path[] = $name; + } + $client = new static($this->host, $this->headers, $this->version, $this->path); + $client->setCurlOptions($this->curlOptions); + $client->setRetryOnLimit($this->retryOnLimit); + $this->path = []; + + return $client; } /** - * Dynamically add method calls to the url, then call a method. - * (e.g. client.name.name.method()) - * - * @param string $name name of the dynamic method call or HTTP verb - * @param array $args parameters passed with the method call - * - * @return Client|Response object - */ + * Dynamically add method calls to the url, then call a method. + * (e.g. client.name.name.method()) + * + * @param string $name name of the dynamic method call or HTTP verb + * @param array $args parameters passed with the method call + * + * @return Client|Response|Response[]|null object + */ public function __call($name, $args) { $name = strtolower($name); @@ -221,12 +569,25 @@ class Client return $this->_(); } + // send all saved requests + if (($name === 'send') && $this->isConcurrentRequest) { + return $this->makeAllRequests(); + } + if (in_array($name, $this->methods, true)) { $body = isset($args[0]) ? $args[0] : null; $queryParams = isset($args[1]) ? $args[1] : null; $url = $this->buildUrl($queryParams); $headers = isset($args[2]) ? $args[2] : null; $retryOnLimit = isset($args[3]) ? $args[3] : $this->retryOnLimit; + + if ($this->isConcurrentRequest) { + // save request to be sent later + $requestData = ['method' => $name, 'url' => $url, 'body' => $body, 'headers' => $headers]; + $this->savedRequests[] = $this->createSavedRequest($requestData, $retryOnLimit); + return null; + } + return $this->makeRequest($name, $url, $body, $headers, $retryOnLimit); } diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php index 29720f0..f658f2c 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php @@ -3,11 +3,9 @@ /** * HTTP Client library * - * PHP version 5.4 - * * @author Matt Bernier <dx@sendgrid.com> * @author Elmer Thomas <dx@sendgrid.com> - * @copyright 2016 SendGrid + * @copyright 2018 SendGrid * @license https://opensource.org/licenses/MIT The MIT License * @version GIT: <git_id> * @link http://packagist.org/packages/sendgrid/php-http-client @@ -20,21 +18,29 @@ namespace SendGrid; */ class Response { - /** @var int */ + /** + * @var int + */ protected $statusCode; - /** @var string */ + + /** + * @var string + */ protected $body; - /** @var array */ + + /** + * @var array + */ protected $headers; /** * Setup the response data * - * @param int $statusCode the status code. - * @param string $body the response body. - * @param array $headers an array of response headers. + * @param int $statusCode the status code. + * @param string $body the response body. + * @param array $headers an array of response headers. */ - public function __construct($statusCode = null, $body = null, $headers = null) + public function __construct($statusCode = 200, $body = '', array $headers = []) { $this->statusCode = $statusCode; $this->body = $body; @@ -79,25 +85,16 @@ class Response /** * Returns response headers as associative array - * + * * @param array $headers * * @return array - * - * @throws \InvalidArgumentException */ - private function prettifyHeaders($headers) + private function prettifyHeaders(array $headers) { - if (!is_array($headers)) { - throw new \InvalidArgumentException('$headers should be array'); - } - return array_reduce( array_filter($headers), function ($result, $header) { - if (empty($header)) { - return $result; - } if (false === strpos($header, ':')) { $result['Status'] = trim($header); @@ -105,7 +102,7 @@ class Response return $result; } - list ($key, $value) = explode(':', $header, 2); + list($key, $value) = explode(':', $header, 2); $result[trim($key)] = trim($value); return $result; diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE index 8e2d043..d378427 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE @@ -2,7 +2,6 @@ A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples. - #### Steps to Reproduce 1. This is the first step @@ -14,4 +13,4 @@ Any other information you want to share that is relevant to the issue being repo #### Technical details: * sendgrid-php Version: master (latest commit: [commit number]) -* PHP Version: 5.x
\ No newline at end of file +* PHP Version: 5.6, 7.0, 7.1, 7.2 (as of May 17, 2018) diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore index 8f8f4f1..efe514c 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore @@ -2,9 +2,18 @@ test/coverage/* dist/ composer.lock vendor -.env* +.env sendgrid.env composer.phar .editorconfig test.php -.idea/
\ No newline at end of file +.idea/ +test/prism_linux_amd64 +test/prism/* +!test/prim +*.code-workspace +.vscode +prism* +temp.php +example*.php +TODO.txt diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml index 068c594..c222a38 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml @@ -1,27 +1,26 @@ language: php + before_script: -before_script: -- mkdir prism -- mkdir prism/bin -- export PATH=$PATH:$PWD/prism/bin/ -- ./test/prism.sh - composer install -- cd test/unit +- "./test/prism.sh &" +- sleep 60 +- cd test + script: -- "../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test*" +- "../vendor/bin/phpunit . --filter test*" + after_script: -- cd ../.. -- ./scripts/s3upload.sh +- cd ../ +after_success: +- bash <(curl -s https://codecov.io/bash) + php: - 5.6 - 7.0 -env: - global: - - S3_POLICY: ewogICJleHBpcmF0aW9uIjogIjIxMDAtMDEtMDFUMTI6MDA6MDAuMDAwWiIsCiAgImNvbmRpdGlvbnMiOiBbCiAgICB7ImFjbCI6ICJwdWJsaWMtcmVhZCIgfSwKICAgIHsiYnVja2V0IjogInNlbmRncmlkLW9wZW4tc291cmNlIiB9LAogICAgWyJzdGFydHMtd2l0aCIsICIka2V5IiwgInNlbmRncmlkLXBocC8iXSwKICAgIFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLCAyMDQ4LCAyNjg0MzU0NTZdLAogICAgWyJlcSIsICIkQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3ppcCJdCiAgXQp9Cgo= - - secure: eUN0huKA436uIkISu6V3yW01/gZHC6slBvlnprMPEhzclU2szH6qhWEXWS5CcOG6EEDBReqLZdNAwu+FC69KGFO9+6oW2GQQLSsfEViqFi/Ig2N0r4EBO4jLRebgq0GOfetPwQvJH27d8BCiloPy8rXBb5pskxSNw4B4bRyXHz4= - - secure: j38xzMNmzYXR/JJdVumPmDoDVxb6FUDF497AuVPHowGh0egFW8XHWCOMeQWqWZI4Gg17pViQNIJ3xC6WBvob70AF8fsNm0+vxF2s7abXDMcbq5flLTS6ydKLgNu+na/RAkOBbTwxJAGIH/fQh8BH8iGKerCwoqf8sDErAge4NMw= - - secure: h3HlxBOsNXBDrIJ0yl467ST6Q8R2TmbL7PltlPcRoHy5gAxn5UiDv5W2+6DSXrwQrTjOUunZ+O9ckcaQGQy1JNhGMwgIkJpyWAHDIHhTYGU289uUIDTHQW/soX0qHJSHSx3iMgDOIc7XnfTz6W7Nv1gYKZFedOMsZ5uBMeGyiXE= - - secure: SKSl/RHFQNhGT7OUj7E0AbrQnuDhhCRI/4jC76mmzvy8EJBDgUNevAKJGtug+LVilHrlbk9fLC8rayPW6SGv0s3PowTGm8NMOc48aRBLOr7QRo/sMikJCmRuU6HWptr0NKuf2fq6lV94WDm/pDdyOSNyLga9/eaIDs/Sacp78sw= +- 7.1 +- 7.2 +- 7.3 + notifications: hipchat: rooms: diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md index 2add305..79d38ee 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md @@ -1,208 +1,201 @@ +![SendGrid Logo](https://github.com/sendgrid/sendgrid-python/raw/master/twilio_sendgrid_logo.png) + [![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-php.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-php) +[![Packagist](https://img.shields.io/packagist/v/sendgrid/sendgrid.svg)](https://packagist.org/packages/sendgrid/sendgrid) +[![Downloads](https://img.shields.io/packagist/dt/sendgrid/sendgrid.svg?maxAge=3600)](https://packagist.org/packages/sendgrid/sendgrid) +[![Email Notifications Badge](https://dx.sendgrid.com/badge/php)](https://dx.sendgrid.com/newsletter/php) +[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.md) +[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid) +[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-php.svg)](https://github.com/sendgrid/sendgrid-php/graphs/contributors) +[![Open Source Helpers](https://www.codetriage.com/sendgrid/sendgrid-php/badges/users.svg)](https://www.codetriage.com/sendgrid/sendgrid-php) -Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-php/issues/290). Your support is appreciated! +**NEW:** +- Subscribe to email [notifications](https://dx.sendgrid.com/newsletter/php) for releases and breaking changes. +- Send SMS messages with [Twilio](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md#sms). -**This library allows you to quickly and easily use the SendGrid Web API v3 via PHP.** +**This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP.** -Version 5.X.X of this library provides full support for all SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint). +Version 7.X.X of this library provides full support for all Twilio SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint). -This library represents the beginning of a new path for SendGrid. We want this library to be community driven and SendGrid led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-php/issues) and [pull requests](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests. +We want this library to be community driven and Twilio SendGrid led. Your help is needed to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-php/issues) and [pull requests](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests. -Please browse the rest of this README for further detail. +Please browse the rest of this README for further details. We appreciate your continued support, thank you! # Table of Contents * [Installation](#installation) -* [Quick Start](#quick_start) +* [Quick Start](#quick-start) +* [Use Cases](#use-cases) * [Usage](#usage) -* [Use Cases](#use_cases) * [Announcements](#announcements) * [Roadmap](#roadmap) * [How to Contribute](#contribute) * [Troubleshooting](#troubleshooting) * [About](#about) +* [License](#license) <a name="installation"></a> # Installation ## Prerequisites -- PHP version 5.6 or 7.0 -- The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) +- PHP version 5.6, 7.0, 7.1 or 7.2 +- The Twilio SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) to send up to 40,000 emails for the first 30 days, then send 100 emails/day free forever or check out [our pricing](https://sendgrid.com/pricing?source=sendgrid-php). +- For SMS messages, you will need a free [Twilio account](https://www.twilio.com/try-twilio?source=sendgrid-php). ## Setup Environment Variables Update the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example: +1. Copy the sample env file to a new file named `.env` +```bash +cp .env.sample .env +``` +2. Edit the `.env` file to include your `SENDGRID_API_KEY` +3. Source the `.env` file ```bash -echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env -echo "sendgrid.env" >> .gitignore -source ./sendgrid.env +source ./.env ``` ## Install Package -Add SendGrid to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application. +Add Twilio SendGrid to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), we highly recommend it. It's an excellent way to manage dependencies in your PHP application. ```json { "require": { - "sendgrid/sendgrid": "~6.0" + "sendgrid/sendgrid": "~7" } } ``` #### Alternative: Install package from zip -If you are not using Composer, simply download and install the **[latest packaged release of the library as a zip](https://github.com/sendgrid/sendgrid-php/archive/master.zip)**. +If you are not using Composer, simply download and install the **[latest packaged release of the library as a zip](https://github.com/sendgrid/sendgrid-php/releases/download/v7.3.0/sendgrid-php.zip)**. -[**⬇︎ Download Packaged Library ⬇︎**](https://github.com/sendgrid/sendgrid-php/archive/master.zip) +[**⬇︎ Download Packaged Library ⬇︎**](https://github.com/sendgrid/sendgrid-php/releases/download/v7.3.0/sendgrid-php.zip) -Previous versions of the library can be found in the [version index](https://sendgrid-open-source.s3.amazonaws.com/index.html) or downloaded directly from GitHub. +Previous versions of the library can be found in the [version index](https://sendgrid-open-source.s3.amazonaws.com/index.html) or downloaded directly from [GitHub](https://github.com/sendgrid/sendgrid-php/releases). ## Dependencies -- The SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) -- [php-HTTP-Client](https://github.com/sendgrid/php-http-client) +- The Twilio SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) +- The dependency free [php-http-client](https://github.com/sendgrid/php-http-client) -<a name="quick_start"></a> +<a name="quick-start"></a> # Quick Start ## Hello Email -The following is the minimum needed code to send an email with the [/mail/send Helper](https://github.com/sendgrid/sendgrid-php/tree/master/lib/helpers/mail) ([here](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php#L22) is a full example): +The following is the minimum needed code to send an email. You may find more examples in our USE_CASES file: ```php <?php -// If you are using Composer (recommended) -require 'vendor/autoload.php'; - -// If you are not using Composer -// require("path/to/sendgrid-php/sendgrid-php.php"); - -$from = new SendGrid\Email("Example User", "test@example.com"); -$subject = "Sending with SendGrid is Fun"; -$to = new SendGrid\Email("Example User", "test@example.com"); -$content = new SendGrid\Content("text/plain", "and easy to do anywhere, even with PHP"); -$mail = new SendGrid\Mail($from, $subject, $to, $content); - -$apiKey = getenv('SENDGRID_API_KEY'); -$sg = new \SendGrid($apiKey); - -$response = $sg->client->mail()->send()->post($mail); -echo $response->statusCode(); -print_r($response->headers()); -echo $response->body(); +require 'vendor/autoload.php'; // If you're using Composer (recommended) +// Comment out the above line if not using Composer +// require("<PATH TO>/sendgrid-php.php"); +// If not using Composer, uncomment the above line and +// download sendgrid-php.zip from the latest release here, +// replacing <PATH TO> with the path to the sendgrid-php.php file, +// which is included in the download: +// https://github.com/sendgrid/sendgrid-php/releases + +$email = new \SendGrid\Mail\Mail(); +$email->setFrom("test@example.com", "Example User"); +$email->setSubject("Sending with Twilio SendGrid is Fun"); +$email->addTo("test@example.com", "Example User"); +$email->addContent("text/plain", "and easy to do anywhere, even with PHP"); +$email->addContent( + "text/html", "<strong>and easy to do anywhere, even with PHP</strong>" +); +$sendgrid = new \SendGrid(getenv('SENDGRID_API_KEY')); +try { + $response = $sendgrid->send($email); + print $response->statusCode() . "\n"; + print_r($response->headers()); + print $response->body() . "\n"; +} catch (Exception $e) { + echo 'Caught exception: '. $e->getMessage() ."\n"; +} ``` -The `SendGrid\Mail` constructor creates a [personalization object](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html) for you. [Here](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php#L16) is an example of how to add to it. - -### Without Mail Helper Class - -The following is the minimum needed code to send an email without the /mail/send Helper ([here](https://github.com/sendgrid/sendgrid-php/blob/master/examples/mail/mail.php#L28) is a full example): - -```php -<?php -// If you are using Composer (recommended) -require 'vendor/autoload.php'; - -// If you are not using Composer -// require("path/to/sendgrid-php/sendgrid-php.php"); - -$request_body = json_decode('{ - "personalizations": [ - { - "to": [ - { - "email": "test@example.com" - } - ], - "subject": "Sending with SendGrid is Fun" - } - ], - "from": { - "email": "test@example.com" - }, - "content": [ - { - "type": "text/plain", - "value": "and easy to do anywhere, even with PHP" - } - ] -}'); - -$apiKey = getenv('SENDGRID_API_KEY'); -$sg = new \SendGrid($apiKey); - -$response = $sg->client->mail()->send()->post($request_body); -echo $response->statusCode(); -echo $response->body(); -print_r($response->headers()); -``` +The `SendGrid\Mail` constructor creates a [personalization object](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html) for you. [Here](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md#kitchen-sink) is an example of how to add to it. ## General v3 Web API Usage (With Fluent Interface) ```php <?php -// If you are using Composer (recommended) -require 'vendor/autoload.php'; - -// If you are not using Composer -// require("path/to/sendgrid-php/sendgrid-php.php"); +require 'vendor/autoload.php'; // If you're using Composer (recommended) +// Comment out the above line if not using Composer +// Comment out the above line if not using Composer +// require("<PATH TO>/sendgrid-php.php"); +// If not using Composer, uncomment the above line and +// download sendgrid-php.zip from the latest release here, +// replacing <PATH TO> with the path to the sendgrid-php.php file, +// which is included in the download: +// https://github.com/sendgrid/sendgrid-php/releases $apiKey = getenv('SENDGRID_API_KEY'); $sg = new \SendGrid($apiKey); -$response = $sg->client->suppression()->bounces()->get(); - -print $response->statusCode(); -print $response->headers(); -print $response->body(); +try { + $response = $sg->client->suppression()->bounces()->get(); + print $response->statusCode() . "\n"; + print_r($response->headers()); + print $response->body() . "\n"; +} catch (Exception $e) { + echo 'Caught exception: '. $e->getMessage(). "\n"; +} ``` ## General v3 Web API Usage (Without Fluent Interface) ```php <?php -// If you are using Composer (recommended) -require 'vendor/autoload.php'; - -// If you are not using Composer -// require("path/to/sendgrid-php/sendgrid-php.php"); +require 'vendor/autoload.php'; // If you're using Composer (recommended) +// Comment out the above line if not using Composer +// Comment out the above line if not using Composer +// require("<PATH TO>/sendgrid-php.php"); +// If not using Composer, uncomment the above line and +// download sendgrid-php.zip from the latest release here, +// replacing <PATH TO> with the path to the sendgrid-php.php file, +// which is included in the download: +// https://github.com/sendgrid/sendgrid-php/releases $apiKey = getenv('SENDGRID_API_KEY'); $sg = new \SendGrid($apiKey); -$response = $sg->client->_("suppression/bounces")->get(); - -print $response->statusCode(); -print $response->headers(); -print $response->body(); +try { + $response = $sg->client->_("suppression/bounces")->get(); + print $response->statusCode() . "\n"; + print_r($response->headers()); + print $response->body() . "\n"; +} catch (Exception $e) { + echo 'Caught exception: '. $e->getMessage(). "\n"; +} ``` +<a name="use-cases"></a> +# Use Cases + +[Examples of common API use cases](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md), such as how to send an email with a transactional template. + <a name="usage"></a> # Usage -- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html) -- [Library Usage +- [Twilio SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html) +- [Generic Library Usage Documentation](https://github.com/sendgrid/sendgrid-php/tree/master/USAGE.md) -- [Example Code](https://github.com/sendgrid/sendgrid-php/tree/master/examples) -- [How-to: Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html) -- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-php/tree/master/lib/helpers/mail/README.md) - build a request object payload for a v3 /mail/send API call. - -<a name="use_cases"> -# Use Cases - -[Examples of common API use cases](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md), such as how to send an email with a transactional template. +- [Example Code](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md) <a name="announcements"></a> # Announcements -Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-php/issues/290). Your support is appreciated! +v7 has been released! Please see the [release notes](https://github.com/sendgrid/sendgrid-php/releases/tag/v7.0.0) for details. -All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-php/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-php/releases) +All updates to this library are documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-php/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-php/releases). You may also subscribe to email [release notifications](https://dx.sendgrid.com/newsletter/php) for releases and breaking changes. <a name="roadmap"></a> # Roadmap @@ -220,6 +213,7 @@ Quick links: - [Bug Reports](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#submit_a_bug_report) - [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#cla) - [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#improvements_to_the_codebase) +- [Review Pull Requests](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#code-reviews) <a name="troubleshooting"></a> # Troubleshooting @@ -229,9 +223,10 @@ Please see our [troubleshooting guide](https://github.com/sendgrid/sendgrid-php/ <a name="about"></a> # About -sendgrid-php is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com). +sendgrid-php is guided and supported by the Twilio [Developer Experience Team](mailto:dx@sendgrid.com). -sendgrid-php is maintained and funded by SendGrid, Inc. The names and logos for sendgrid-php are trademarks of SendGrid, Inc. +sendgrid-php is maintained and funded by Twilio SendGrid, Inc. The names and logos for sendgrid-php are trademarks of Twilio SendGrid, Inc. -![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png) +# License +[The MIT License (MIT)](LICENSE.txt) diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json index 2e2a398..d7dea0e 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json @@ -1,23 +1,47 @@ { "name": "sendgrid/sendgrid", - "description": "This library allows you to quickly and easily send emails through SendGrid using PHP.", - "version": "6.0.0", + "description": "This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.", + "version": "7.3.0", "homepage": "http://github.com/sendgrid/sendgrid-php", "license": "MIT", - "keywords": ["SendGrid", "sendgrid", "email", "send", "grid"], + "keywords": [ + "SendGrid", + "sendgrid", + "Twilio SendGrid", + "twilio sendgrid", + "email", + "send", + "grid" + ], "require": { "php": ">=5.6", - "sendgrid/php-http-client": "~3.7" + "sendgrid/php-http-client": "~3.9", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*" }, "require-dev": { - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "2.*" + "phpunit/phpunit": "^5.7.9 || ^6.4.3", + "squizlabs/php_codesniffer": "3.*", + "swaggest/json-diff": "^3.4" }, "replace": { "sendgrid/sendgrid-php": "*" }, "type": "library", "autoload": { - "files": ["lib/SendGrid.php", "lib/helpers/mail/Mail.php"] + "psr-4": { + "SendGrid\\": "lib/", + "SendGrid\\Mail\\": "lib/mail/", + "SendGrid\\Contacts\\": "lib/contacts/", + "SendGrid\\Stats\\": "lib/stats/" + }, + "files": ["lib/SendGrid.php"] + }, + "autoload-dev": { + "psr-4": { + "SendGrid\\Tests\\": "test/" + } } -}
\ No newline at end of file +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php index 0bda1b5..08ee1d6 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php @@ -1,43 +1,42 @@ <?php /** - * This library allows you to quickly and easily send emails through SendGrid using PHP. - * - * @author Elmer Thomas <dx@sendgrid.com> - * @copyright 2017 SendGrid - * @license https://opensource.org/licenses/MIT The MIT License - * @version GIT: <git_id> - * @link http://packagist.org/packages/sendgrid/sendgrid - */ + * This library allows you to quickly and easily send emails through + * Twilio SendGrid using PHP. + * + * PHP Version - 5.6, 7.0, 7.1, 7.2 + * + * @package SendGrid\Tests + * @author Elmer Thomas <dx@sendgrid.com> + * @copyright 2018-19 Twilio SendGrid + * @license https://opensource.org/licenses/MIT The MIT License + * @version GIT: <git_id> + * @link http://packagist.org/packages/sendgrid/sendgrid + */ /** - * Interface to the SendGrid Web API - */ + * This class is the interface to the Twilio SendGrid Web API + * + * @package SendGrid\Mail + */ class SendGrid { - const VERSION = '6.0.0'; + const VERSION = '7.3.0'; - /** - * - * @var string - */ + // @var string protected $namespace = 'SendGrid'; - /** - * @var \SendGrid\Client - */ + // @var \SendGrid\Client public $client; - - /** - * @var string - */ + // @var string public $version = self::VERSION; /** - * Setup the HTTP Client - * - * @param string $apiKey your SendGrid API Key. - * @param array $options an array of options, currently only "host" and "curl" are implemented. - */ + * Setup the HTTP Client + * + * @param string $apiKey Your Twilio SendGrid API Key. + * @param array $options An array of options, currently only "host", "curl" and + * "impersonateSubuser" are implemented. + */ public function __construct($apiKey, $options = array()) { $headers = array( @@ -46,10 +45,33 @@ class SendGrid 'Accept: application/json' ); - $host = isset($options['host']) ? $options['host'] : 'https://api.sendgrid.com'; + $host = isset($options['host']) ? $options['host'] : + 'https://api.sendgrid.com'; + + if (!empty($options['impersonateSubuser'])) { + $headers[] = 'On-Behalf-Of: '. $options['impersonateSubuser']; + } $curlOptions = isset($options['curl']) ? $options['curl'] : null; - $this->client = new \SendGrid\Client($host, $headers, '/v3', null, $curlOptions); + $this->client = new \SendGrid\Client( + $host, + $headers, + '/v3', + null, + $curlOptions + ); + } + + /** + * Make an API request + * + * @param \SendGrid\Mail\Mail $email A Mail object, containing the request object + * + * @return \SendGrid\Response + */ + public function send(\SendGrid\Mail\Mail $email) + { + return $this->client->mail()->send()->post($email); } } diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php index ed17dfe..9e6a749 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php @@ -1,6 +1,54 @@ <?php /** * Allows us to include one file instead of two when working without composer. + * + * PHP Version - 5.6, 7.0, 7.1, 7.2 + * + * @package SendGrid\Tests + * @author Elmer Thomas <dx@sendgrid.com> + * @copyright 2018-19 Twilio SendGrid + * @license https://opensource.org/licenses/MIT The MIT License + * @version GIT: <git_id> + * @link http://packagist.org/packages/sendgrid/sendgrid */ require_once __DIR__ . '/SendGrid.php'; -require_once __DIR__ . '/helpers/mail/Mail.php'; +require_once __DIR__ . '/contacts/Recipient.php'; +require_once __DIR__ . '/contacts/RecipientForm.php'; +require_once __DIR__ . '/mail/EmailAddress.php'; +require_once __DIR__ . '/mail/Asm.php'; +require_once __DIR__ . '/mail/Attachment.php'; +require_once __DIR__ . '/mail/BatchId.php'; +require_once __DIR__ . '/mail/Bcc.php'; +require_once __DIR__ . '/mail/BccSettings.php'; +require_once __DIR__ . '/mail/BypassListManagement.php'; +require_once __DIR__ . '/mail/Category.php'; +require_once __DIR__ . '/mail/Cc.php'; +require_once __DIR__ . '/mail/ClickTracking.php'; +require_once __DIR__ . '/mail/Content.php'; +require_once __DIR__ . '/mail/CustomArg.php'; +require_once __DIR__ . '/mail/Footer.php'; +require_once __DIR__ . '/mail/From.php'; +require_once __DIR__ . '/mail/Ganalytics.php'; +require_once __DIR__ . '/mail/GroupId.php'; +require_once __DIR__ . '/mail/GroupsToDisplay.php'; +require_once __DIR__ . '/mail/Header.php'; +require_once __DIR__ . '/mail/HtmlContent.php'; +require_once __DIR__ . '/mail/IpPoolName.php'; +require_once __DIR__ . '/mail/Mail.php'; +require_once __DIR__ . '/mail/MailSettings.php'; +require_once __DIR__ . '/mail/MimeType.php'; +require_once __DIR__ . '/mail/OpenTracking.php'; +require_once __DIR__ . '/mail/Personalization.php'; +require_once __DIR__ . '/mail/PlainTextContent.php'; +require_once __DIR__ . '/mail/ReplyTo.php'; +require_once __DIR__ . '/mail/Section.php'; +require_once __DIR__ . '/mail/SandBoxMode.php'; +require_once __DIR__ . '/mail/SendAt.php'; +require_once __DIR__ . '/mail/SpamCheck.php'; +require_once __DIR__ . '/mail/Subject.php'; +require_once __DIR__ . '/mail/SubscriptionTracking.php'; +require_once __DIR__ . '/mail/Substitution.php'; +require_once __DIR__ . '/mail/TemplateId.php'; +require_once __DIR__ . '/mail/TrackingSettings.php'; +require_once __DIR__ . '/mail/To.php'; +require_once __DIR__ . '/stats/Stats.php'; |