diff --git a/.travis.yml b/.travis.yml index 79016839d..44c7349e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,52 +2,27 @@ sudo: false language: php -matrix: - include: - - php: 5.3 - env: AUTOLOAD=1 - dist: precise - - php: 5.3 - env: AUTOLOAD=0 - dist: precise - - php: 5.4 - env: AUTOLOAD=1 - - php: 5.4 - env: AUTOLOAD=0 - - php: 5.5 - env: AUTOLOAD=1 - - php: 5.5 - env: AUTOLOAD=0 - - php: 5.6 - env: AUTOLOAD=1 - - php: 5.6 - env: AUTOLOAD=0 - - php: 7.0 - env: AUTOLOAD=1 - - php: 7.0 - env: AUTOLOAD=0 - - php: 7.1 - env: AUTOLOAD=1 - - php: 7.1 - env: AUTOLOAD=0 - - php: 7.2 - env: AUTOLOAD=1 - - php: 7.2 - env: AUTOLOAD=0 - - php: hhvm - env: AUTOLOAD=1 - - php: hhvm - env: AUTOLOAD=0 +php: + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - 7.2 + - hhvm + +env: + global: + - STRIPE_MOCK_VERSION=0.5.0 + matrix: + - AUTOLOAD=1 + - AUTOLOAD=0 cache: directories: - $HOME/.composer/cache/files - stripe-mock -env: - global: - - STRIPE_MOCK_VERSION=0.5.0 - before_install: # Unpack and start stripe-mock so that the test suite can talk to it - | diff --git a/README.md b/README.md index bdc6d353c..0d18bcab8 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ You can sign up for a Stripe account at https://stripe.com. ## Requirements -PHP 5.3.3 and later. +PHP 5.4.0 and later. ## Composer @@ -60,6 +60,12 @@ Please see https://stripe.com/docs/api for up-to-date documentation. ## Legacy Version Support +### PHP 5.3 + +If you are using PHP 5.3, you can download v5.8.0 ([zip](https://github.com/stripe/stripe-php/archive/v5.8.0.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.8.0.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses. + +### PHP 5.2 + If you are using PHP 5.2, you can download v1.18.0 ([zip](https://github.com/stripe/stripe-php/archive/v1.18.0.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v1.18.0.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses. This legacy version may be included via `require_once("/path/to/stripe-php/lib/Stripe.php");`, and used like: diff --git a/build.php b/build.php index 4401bb4b8..cd053e2ba 100755 --- a/build.php +++ b/build.php @@ -10,7 +10,7 @@ $composer = json_decode(file_get_contents('composer.json'), true); unset($composer['autoload']); unset($composer['require-dev']['squizlabs/php_codesniffer']); - file_put_contents('composer.json', json_encode($composer)); + file_put_contents('composer.json', json_encode($composer, JSON_PRETTY_PRINT)); } passthru('composer install', $returnStatus); diff --git a/composer.json b/composer.json index 8cfc38a04..67473fca4 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": ">=5.3.3", + "php": ">=5.4.0", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*" diff --git a/init.php b/init.php index 8dc6406a2..e9eb3baf5 100644 --- a/init.php +++ b/init.php @@ -37,7 +37,6 @@ // Plumbing require(dirname(__FILE__) . '/lib/ApiResponse.php'); -require(dirname(__FILE__) . '/lib/JsonSerializable.php'); require(dirname(__FILE__) . '/lib/StripeObject.php'); require(dirname(__FILE__) . '/lib/ApiRequestor.php'); require(dirname(__FILE__) . '/lib/ApiResource.php'); diff --git a/lib/JsonSerializable.php b/lib/JsonSerializable.php deleted file mode 100644 index 2fdf85267..000000000 --- a/lib/JsonSerializable.php +++ /dev/null @@ -1,18 +0,0 @@ -'.$k.' = NULL to delete the property' @@ -292,11 +289,7 @@ public function jsonSerialize() public function __toJSON() { - if (defined('JSON_PRETTY_PRINT')) { - return json_encode($this->__toArray(true), JSON_PRETTY_PRINT); - } else { - return json_encode($this->__toArray(true)); - } + return json_encode($this->__toArray(true), JSON_PRETTY_PRINT); } public function __toString() diff --git a/tests/Stripe/StripeObjectTest.php b/tests/Stripe/StripeObjectTest.php index 7fcd9ab3d..87616e621 100644 --- a/tests/Stripe/StripeObjectTest.php +++ b/tests/Stripe/StripeObjectTest.php @@ -84,11 +84,6 @@ public function testPropertyDoesNotExists() public function testJsonEncode() { - // We can only JSON encode our objects in PHP 5.4+. 5.3 must use ->__toJSON() - if (version_compare(phpversion(), '5.4.0', '<')) { - return; - } - $s = new StripeObject(); $s->foo = 'a';