diff --git a/composer.json b/composer.json index d55cc26..67779de 100644 --- a/composer.json +++ b/composer.json @@ -1,19 +1,37 @@ { - "name": "matscode/paystack", - "description": "This package is for communicating with PAYSTACK API", - "type": "library", - "keywords": ["payment","paystack", "php"], - "license": "GNU GPLv3", - "minimum-stability": "stable", - "autoload": { - "psr-4": {"Matscode\\Paystack\\": "src/"} - }, - "authors": [ - { - "name": "Michael Akanji", - "email": "matscode@gmail.com", - "homepage": "http://michaelakanji.com" - } - ], - "require": {} + "name": "matscode/paystack", + "description": "This package is for communicating with PAYSTACK API", + "type": "library", + "keywords": [ + "payment", + "paystack", + "php" + ], + "license": "GNU GPLv3", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Matscode\\": "src/" + } + }, + "authors": [ + { + "name": "Michael Akanji", + "email": "matscode@gmail.com", + "homepage": "http://michaelakanji.com" + } + ], + "require": { + "vlucas/phpdotenv": "^3.3", + "ext-openssl": "*", + "lodash-php/lodash-php": "^0.0.5", + "ext-json": "*", + "guzzlehttp/guzzle": "~6.0", + "josantonius/session": "^1.1" + }, + "require-dev": { + "symfony/var-dumper": "^4.2", + "phpunit/phpunit": "^8", + "filp/whoops": "^2.3" + } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..6c5cfd0 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2396 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "fae8a5568529cf947b31db92d3ed8f95", + "packages": [ + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-04-22T15:46:56+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.5.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "9f83dded91781a01c63574e387eaa769be769115" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", + "reference": "9f83dded91781a01c63574e387eaa769be769115", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2018-12-04T20:46:45+00:00" + }, + { + "name": "josantonius/session", + "version": "1.1.8", + "source": { + "type": "git", + "url": "https://github.com/Josantonius/PHP-Session.git", + "reference": "08b09ad43927d172963d15da29259bcdf90a8f43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Josantonius/PHP-Session/zipball/08b09ad43927d172963d15da29259bcdf90a8f43", + "reference": "08b09ad43927d172963d15da29259bcdf90a8f43", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.3 || ^2.8", + "phpmd/phpmd": "^2.6", + "phpunit/phpunit": "^5.7 || ^6.0", + "squizlabs/php_codesniffer": "^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Josantonius\\Session\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josantonius", + "email": "hello@josantonius.com", + "homepage": "https://josantonius.com", + "role": "Developer" + } + ], + "description": "PHP library for handling sessions.", + "keywords": [ + "hhvm", + "php", + "session" + ], + "time": "2018-05-04T08:30:19+00:00" + }, + { + "name": "lodash-php/lodash-php", + "version": "0.0.5", + "source": { + "type": "git", + "url": "https://github.com/lodash-php/lodash-php.git", + "reference": "b9b10cc2c1a148be36f031e66fe7ea9b42e210b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lodash-php/lodash-php/zipball/b9b10cc2c1a148be36f031e66fe7ea9b42e210b2", + "reference": "b9b10cc2c1a148be36f031e66fe7ea9b42e210b2", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/comparator": "^1.2 | ^2.0 | ^2.1 | ^3.0", + "symfony/property-access": "^2.7 | ^3.0 | ^4.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.2", + "phpdocumentor/reflection-docblock": "^4.2", + "phpstan/phpdoc-parser": "^0.3.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pierre du Plessis", + "email": "open-source@solidworx.co" + } + ], + "description": "A port of Lodash to PHP", + "keywords": [ + "lodash", + "php-library", + "php-utility", + "utilities", + "utility", + "utility-library" + ], + "time": "2018-12-10T21:51:40+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/94e644f7d2051a5f0fcf77d81605f152eecff0ed", + "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-0": { + "PhpOption\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "time": "2015-07-25T16:39:46+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "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", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2016-02-11T07:05:27+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-07-12T15:12:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2019-02-04T06:01:07+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2017-04-03T13:19:02+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "symfony/inflector", + "version": "v4.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/inflector.git", + "reference": "275e54941a4f17a471c68d2a00e2513fc1fd4a78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/inflector/zipball/275e54941a4f17a471c68d2a00e2513fc1fd4a78", + "reference": "275e54941a4f17a471c68d2a00e2513fc1fd4a78", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Inflector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Inflector Component", + "homepage": "https://symfony.com", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string", + "symfony", + "words" + ], + "time": "2019-01-16T20:31:39+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "backendtea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/property-access", + "version": "v4.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-access.git", + "reference": "d5e10532c51db0b657b1e25b2bd70acbcd13bbf9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-access/zipball/d5e10532c51db0b657b1e25b2bd70acbcd13bbf9", + "reference": "d5e10532c51db0b657b1e25b2bd70acbcd13bbf9", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/inflector": "~3.4|~4.0" + }, + "require-dev": { + "symfony/cache": "~3.4|~4.0" + }, + "suggest": { + "psr/cache-implementation": "To cache access methods." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyAccess\\": "" + }, + "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 PropertyAccess Component", + "homepage": "https://symfony.com", + "keywords": [ + "access", + "array", + "extraction", + "index", + "injection", + "object", + "property", + "property path", + "reflection" + ], + "time": "2019-02-23T15:17:42+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v3.3.3", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "dbcc609971dd9b55f48b8008b553d79fd372ddde" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/dbcc609971dd9b55f48b8008b553d79fd372ddde", + "reference": "dbcc609971dd9b55f48b8008b553d79fd372ddde", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0", + "phpoption/phpoption": "^1.5", + "symfony/polyfill-ctype": "^1.9" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "http://www.vancelucas.com" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "time": "2019-03-06T09:39:45+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.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": "2017-07-22T11:58:36+00:00" + }, + { + "name": "filp/whoops", + "version": "2.3.1", + "source": { + "type": "git", + "url": "https://github.com/filp/whoops.git", + "reference": "bc0fd11bc455cc20ee4b5edabc63ebbf859324c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/filp/whoops/zipball/bc0fd11bc455cc20ee4b5edabc63ebbf859324c7", + "reference": "bc0fd11bc455cc20ee4b5edabc63ebbf859324c7", + "shasum": "" + }, + "require": { + "php": "^5.5.9 || ^7.0", + "psr/log": "^1.0.1" + }, + "require-dev": { + "mockery/mockery": "^0.9 || ^1.0", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp", + "role": "Developer" + } + ], + "description": "php error handling for cool kids", + "homepage": "https://filp.github.io/whoops/", + "keywords": [ + "error", + "exception", + "handling", + "library", + "throwable", + "whoops" + ], + "time": "2018-10-23T09:00:00+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2018-06-11T23:09:50+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2018-08-05T17:53:17+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "7.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "0317a769a81845c390e19684d9ba25d7f6aa4707" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0317a769a81845c390e19684d9ba25d7f6aa4707", + "reference": "0317a769a81845c390e19684d9ba25d7f6aa4707", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.2", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^4.1", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.0" + }, + "suggest": { + "ext-xdebug": "^2.6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2019-02-26T07:38:26+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "050bedf145a257b1ff02746c31894800e5122946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2018-09-13T20:33:42+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b389aebe1b8b0578430bda0c7c95a829608e059", + "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2019-02-20T10:12:59+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2018-10-30T05:52:18+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "8.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "a7af0201285445c9c73c4bdf869c486e36b41604" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a7af0201285445c9c73c4bdf869c486e36b41604", + "reference": "a7af0201285445c9c73c4bdf869c486e36b41604", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.2", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^7.0", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.0", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^3.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2019-02-18T09:23:05+00:00" + }, + { + "name": "psr/log", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "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", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2018-11-20T15:27:04+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6fda8ce1974b62b14935adc02a9ed38252eca656", + "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2019-02-01T05:27:49+00:00" + }, + { + "name": "sebastian/global-state", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "shasum": "" + }, + "require": { + "php": "^7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^8.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2019-02-01T05:30:01+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-09-21T13:07:52+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631", + "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2018-09-21T13:07:52+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v4.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "9f87189ac10b42edf7fb8edc846f1937c6d157cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/9f87189ac10b42edf7fb8edc846f1937c6d157cf", + "reference": "9f87189ac10b42edf7fb8edc846f1937c6d157cf", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0", + "twig/twig": "~1.34|~2.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2019-02-23T15:17:42+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-12-25T11:19:39+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "ext-openssl": "*", + "ext-json": "*" + }, + "platform-dev": [] +} diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..89b9142 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,35 @@ + + + + + PayStack Library + + + + + + + +
+ +

PayStack Library

+ +
+ + + + + + + diff --git a/example/.env b/example/.env new file mode 100644 index 0000000..e2615dc --- /dev/null +++ b/example/.env @@ -0,0 +1 @@ +PAYSTACK_SECRET_KEY= diff --git a/test/callback.php b/example/callback.php similarity index 100% rename from test/callback.php rename to example/callback.php diff --git a/example/index.php b/example/index.php new file mode 100644 index 0000000..5f3e550 --- /dev/null +++ b/example/index.php @@ -0,0 +1,44 @@ + + * @date 2017-06-26 + * + */ +require_once "../vendor/autoload.php"; + +use Matscode\Paystack\Transaction; +use Matscode\Utility\Debug; +use Matscode\Utility\Http; + +$secretKey = 'sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; + +// creating the transaction object +$Transaction = new Transaction($secretKey); + +// Set data to post using this method +/* +$response = $Transaction->initialize( [ + 'email' => 'customer@email.com', + 'amount' => 500000 +] ); +*/ + +// OR + +$response = + $Transaction + ->setEmail('matscode@gmail.com') + ->setAmount(50) + ->initialize(); + +// print response +Debug::print_r($response); + +// save reference somewhere and do a redirect +Http::redirect($response->authorizationUrl); + diff --git a/src/Base.php b/src/Base.php deleted file mode 100644 index 21af3a5..0000000 --- a/src/Base.php +++ /dev/null @@ -1,152 +0,0 @@ - - * @date 2017-06-26 - * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com) - * - */ - - namespace Matscode\Paystack; - - use Matscode\Paystack\CURL; - use Matscode\Paystack\Utility\Text; - - class Base - { - - private - $_apiBaseUrl = 'https://api.paystack.co/', // with trailing slash - $_curl, - $_secretKey, - $_endPoint, - - /*Getting Error Infomation*/ - $_errorMessages = []; - - public - $resource, - $action, - $args, - $data, - // response from the endpoint - $response; - - public function __construct( $secretKey ) - { - // save key in memory - $this->_secretKey = $secretKey; - - return $this; - } - - public function setResource( $resource ) - { - $this->resource = $resource; - - return $this; - } - - public function setAction( $action, array $args = [] ) - { - if ( ! is_array( $args ) ) { - throw new \Exception( 'Action arguments can only be of datatype Array' ); - } - - $this->action = $action; - $this->args = $args; - - return $this; - } - - /** - * Initiate Request to the paystack RESTful API and return response Obj - * - * @param array $withData - * @param string $requestMethod - * @param bool $returnArray set to true to return response as associate array - * - * @todo Utilize the third argument.. - * - * @return mixed - * @throws \Exception - */ - public function sendRequest( array $withData = [], $requestMethod = 'POST', $returnArray = false ) - { - if ( ! is_array( $withData ) ) { - throw new \Exception( 'sendRequest arguments can only be of datatype Array' ); - } - - $this->data = $withData; - - $this->_endPoint = $this->_apiBaseUrl . - Text::removeSlashes( $this->resource ) . '/' . - Text::removeSlashes( $this->action ); - // append parameters to endPoint - if ( count( $this->args ) > 0 ) { - $this->_endPoint .= '/' . implode( '/', $this->args ); - } - - // send the request and return result as json object - $this->_curl = - ( new CURL( - $this->_endPoint, - $requestMethod ) ) - ->setRequestHeader( 'Authorization', 'Bearer ' . $this->_secretKey ); - - $this->response = - json_decode( - $this->_curl - ->run( $this->data, 'json' ) ); - - return $this->response; - } - - /** - * @return mixed - */ - public function getEndPoint() - { - // this works only after executing sendRequest - return $this->_endPoint; - } - - /** - * @param mixed $errorMessages - */ - public function setErrorMessages( $errorMessages ) - { - //if errorMessages is string - if ( is_string( $errorMessages ) ) { - $this->_errorMessages[] = $errorMessages; - } - //if errorMessages is array - if ( is_array( $errorMessages ) ) { - $this->_errorMessages = array_merge( $this->_errorMessages, $errorMessages ); - } - } - - /** - * @param bool $toString - * @param string $delimiter - * - * @return array|string - */ - public function getErrorMessages( $toString = false, $delimiter = '
' ) - { - $errorMessages = $this->_errorMessages; - if ( $toString ) { - // return errorMessage as String - unset( $errorMessages ); //to avoid datatype conflict - $errorMessages = join( $delimiter, $this->_errorMessages ); - } - - return $errorMessages; - } - - - } \ No newline at end of file diff --git a/src/CURL.php b/src/CURL.php deleted file mode 100644 index 93d9e7c..0000000 --- a/src/CURL.php +++ /dev/null @@ -1,247 +0,0 @@ - - * @date 2017-06-25 - * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com) - * - */ - - namespace Matscode\Paystack; - - class CURL - { - private - $_url, - $_curl, - $_requestWithPost = false, - $_allowedReqMethodForPost = - [ - 'POST', - 'UPDATE', - 'PUT', - 'PATCH', - ], - $_errorCode, - $_errorMessage; - - public - $requestMethod, - $requestHeader = []; - - const - USER_AGENT = 'PHP CURL/1.0 (@matscode)'; - - - public function __construct( $url, $requestMethod = null ) - { - if ( ! extension_loaded( 'curl' ) ) { - throw new \ErrorException( 'CURL Extension not loaded, Install libcurl php extension' ); - } - - //initialize CUrl - $this->_url = $url; - $this->_curlInit( $this->_url ); - - //set requestMethod property - $this->requestMethod = $requestMethod; - - //set the default request method to 'POST' - if ( ! is_null( $this->requestMethod ) ) { - $this->setRequestMethod( $this->requestMethod ); - } - - return $this; - } - - private function _curlInit( $url ) - { - $this->_curl = curl_init(); - - $this->setOption( CURLOPT_USERAGENT, self::USER_AGENT ) - ->setOption( CURLOPT_URL, $url ) - // return response - ->setOption( CURLOPT_RETURNTRANSFER, true ); - - // turn off caching - $this->setRequestHeader( 'Cache-Control', 'no-cache' ); - - return $this; - } - - public function setOption( $option, $value ) - { - // Set curl option - curl_setopt( $this->_curl, $option, $value ); - - return $this; - } - - public function setRequestMethod( $requestMethod ) - { - switch ( $requestMethod ) { - case 'GET' : - $this->setOption( CURLOPT_HTTPGET, true ); - break; - case 'UPDATE' : - $this->setOption( CURLOPT_CUSTOMREQUEST, 'UPDATE' ); - break; - case 'PUT' : - $this->setOption( CURLOPT_CUSTOMREQUEST, 'PUT' ); - break; - case 'PATCH' : - $this->setOption( CURLOPT_CUSTOMREQUEST, 'PATCH' ); - break; - case 'DELETE' : - $this->setOption( CURLOPT_CUSTOMREQUEST, 'DELETE' ); - break; - case 'POST': - $this->doPostRequest(); - - default: - $this->setOption( CURLOPT_POST, true ); - break; - } - - return $this; - } - - - /** - * @param null $qStringArray - * - * @return string - */ - public function getUrl( $qStringArray = null ) - { - if ( ! is_null( $qStringArray ) && - ( is_array( $qStringArray ) || is_object( $qStringArray ) ) - ) { - $this->_url .= '?' . http_build_query( $qStringArray ); - } - - return $this->_url; - } - - /** - * @param string $url - * - * @return $this - */ - public function setUrl( - $url - ) { - $this->setOption( CURLOPT_URL, $url ); - $this->_url = $url; - - return $this; - } - - public function doPostRequest() - { - if ( in_array( $this->requestMethod, $this->_allowedReqMethodForPost ) ) { - $this->_requestWithPost = true; - } - - return $this; - } - - public function run( $data, $as = 'urlencoded', $closeCurl = false ) // urlencoded | json | form-data - { - if ( $this->_requestWithPost ) { - //make a post request - switch ( $as ) { - case 'json': - if ( is_array( $data ) ) { - $data = json_encode( $data ); - $this->setRequestHeader( 'Content-Type', 'application/json' ); - } else { - throw new \ErrorException( 'Data argument passed to the run method must be of datatype Array when posting as JSON' ); - } - break; - case 'form-data': - if ( is_array( $data ) || is_object( $data ) ) { - $this->setRequestHeader( 'Content-Type', 'multipart/form-data' ); - } else { - throw new \ErrorException( 'Data argument passed to the run method must be of datatype Array or Object when postiing as FORM-DATA' ); - } - break; - case 'urlenconded': - // convert data to queryString - Native - $data = http_build_query( $data ); - // continue to default - default: - $this->setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); - break; - } - - $this->setOption( CURLOPT_POSTFIELDS, $data ); //Post Fields - } else { - //make a built query string and reset CURLOPT_URL - $this->setOption( CURLOPT_URL, $this->getUrl( $data ) ); - } - - // execute curl - $response = curl_exec( $this->_curl ); - // save error details in memory - $this->_errorCode = curl_errno( $this->_curl ); - $this->_errorMessage = curl_error( $this->_curl ); - - if ( $closeCurl ) { - // close curl connection by default - if ( is_resource( $this->_curl ) ) { - curl_close( $this->_curl ); - } - } - - // return response from endpoint - return $response; - } - - /** - * @param $key - * @param $value - * - * @return $this - */ - public function setRequestHeader( $key, $value = null ) - { - if ( ! is_array( $key ) ) { - // assist with capitalizing http header keys - $headers[] = ucwords( $key ) . ': ' . $value; - } else { - $headers = $key; - } - - // merge requestHeader to base header - $this->requestHeader = array_merge( $headers, $this->requestHeader ); - - $this->setOption( CURLOPT_HTTPHEADER, $this->requestHeader ); - - return $this; - } - - - public function getErrorCode() - { - return $this->_errorCode; - } - - public function getErrorMessage() - { - return $this->_errorMessage; - } - - /** - * @return array - */ - public function getRequestHeader() - { - return $this->requestHeader; - } - - } \ No newline at end of file diff --git a/src/Http/.gitignore b/src/Http/.gitignore new file mode 100644 index 0000000..bfa6a22 --- /dev/null +++ b/src/Http/.gitignore @@ -0,0 +1 @@ +# Created by .ignore support plugin (hsz.mobi) diff --git a/src/Http/CURL.php b/src/Http/CURL.php new file mode 100644 index 0000000..b41e4ce --- /dev/null +++ b/src/Http/CURL.php @@ -0,0 +1,246 @@ + + * @date 2017-06-25 + * + */ + +namespace Matscode\Http; + +class CURL +{ + private + $_url, + $_curl, + $_requestWithPost = false, + $_allowedReqMethodForPost = + [ + 'POST', + 'UPDATE', + 'PUT', + 'PATCH', + ], + $_errorCode, + $_errorMessage; + + public + $requestMethod, + $requestHeader = []; + + const + USER_AGENT = 'PHP CURL/1.0 (@matscode)'; + + + public function __construct($url, $requestMethod = null) + { + if (!extension_loaded('curl')) { + throw new \ErrorException('CURL Extension not loaded, Install libcurl php extension'); + } + + //initialize CUrl + $this->_url = $url; + $this->_curlInit($this->_url); + + //set requestMethod property + $this->requestMethod = $requestMethod; + + //set the default request method to 'POST' + if (!is_null($this->requestMethod)) { + $this->setRequestMethod($this->requestMethod); + } + + return $this; + } + + private function _curlInit($url) + { + $this->_curl = curl_init(); + + $this->setOption(CURLOPT_USERAGENT, self::USER_AGENT) + ->setOption(CURLOPT_URL, $url) + // return response + ->setOption(CURLOPT_RETURNTRANSFER, true); + + // turn off caching + $this->setRequestHeader('Cache-Control', 'no-cache'); + + return $this; + } + + public function setOption($option, $value) + { + // Set curl option + curl_setopt($this->_curl, $option, $value); + + return $this; + } + + public function setRequestMethod($requestMethod) + { + switch ($requestMethod) { + case 'GET' : + $this->setOption(CURLOPT_HTTPGET, true); + break; + case 'UPDATE' : + $this->setOption(CURLOPT_CUSTOMREQUEST, 'UPDATE'); + break; + case 'PUT' : + $this->setOption(CURLOPT_CUSTOMREQUEST, 'PUT'); + break; + case 'PATCH' : + $this->setOption(CURLOPT_CUSTOMREQUEST, 'PATCH'); + break; + case 'DELETE' : + $this->setOption(CURLOPT_CUSTOMREQUEST, 'DELETE'); + break; + case 'POST': + $this->doPostRequest(); + + default: + $this->setOption(CURLOPT_POST, true); + break; + } + + return $this; + } + + + /** + * @param null $qStringArray + * + * @return string + */ + public function getUrl($qStringArray = null) + { + if (!is_null($qStringArray) && + (is_array($qStringArray) || is_object($qStringArray)) + ) { + $this->_url .= '?' . http_build_query($qStringArray); + } + + return $this->_url; + } + + /** + * @param string $url + * + * @return $this + */ + public function setUrl( + $url + ) { + $this->setOption(CURLOPT_URL, $url); + $this->_url = $url; + + return $this; + } + + public function doPostRequest() + { + if (in_array($this->requestMethod, $this->_allowedReqMethodForPost)) { + $this->_requestWithPost = true; + } + + return $this; + } + + public function run($data, $as = 'urlencoded', $closeCurl = false) // urlencoded | json | form-data + { + if ($this->_requestWithPost) { + //make a post request + switch ($as) { + case 'json': + if (is_array($data)) { + $data = json_encode($data); + $this->setRequestHeader('Content-Type', 'application/json'); + } else { + throw new \ErrorException('Data argument passed to the run method must be of datatype Array when posting as JSON'); + } + break; + case 'form-data': + if (is_array($data) || is_object($data)) { + $this->setRequestHeader('Content-Type', 'multipart/form-data'); + } else { + throw new \ErrorException('Data argument passed to the run method must be of datatype Array or Object when postiing as FORM-DATA'); + } + break; + case 'urlenconded': + // convert data to queryString - Native + $data = http_build_query($data); + // continue to default + default: + $this->setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + break; + } + + $this->setOption(CURLOPT_POSTFIELDS, $data); //Post Fields + } else { + //make a built query string and reset CURLOPT_URL + $this->setOption(CURLOPT_URL, $this->getUrl($data)); + } + + // execute curl + $response = curl_exec($this->_curl); + // save error details in memory + $this->_errorCode = curl_errno($this->_curl); + $this->_errorMessage = curl_error($this->_curl); + + if ($closeCurl) { + // close curl connection by default + if (is_resource($this->_curl)) { + curl_close($this->_curl); + } + } + + // return response from endpoint + return $response; + } + + /** + * @param $key + * @param $value + * + * @return $this + */ + public function setRequestHeader($key, $value = null) + { + if (!is_array($key)) { + // assist with capitalizing http header keys + $headers[] = ucwords($key) . ': ' . $value; + } else { + $headers = $key; + } + + // merge requestHeader to base header + $this->requestHeader = array_merge($headers, $this->requestHeader); + + $this->setOption(CURLOPT_HTTPHEADER, $this->requestHeader); + + return $this; + } + + + public function getErrorCode() + { + return $this->_errorCode; + } + + public function getErrorMessage() + { + return $this->_errorMessage; + } + + /** + * @return array + */ + public function getRequestHeader() + { + return $this->requestHeader; + } + +} diff --git a/src/Http/RequestBridge.php b/src/Http/RequestBridge.php new file mode 100644 index 0000000..32b1319 --- /dev/null +++ b/src/Http/RequestBridge.php @@ -0,0 +1,83 @@ + + * @date 2019-03-09 + */ + +namespace Matscode\Http; + +use function _\internal\parent; +use GuzzleHttp\Client; +use GuzzleHttp\Exception\GuzzleException; +use GuzzleHttp\Psr7\Request; +use Matscode\Utility\StringPlay; + +class RequestBridge extends Client +{ + private + $_requestMethod, + $_requestHeaders = [], + $_requestPath, + $_requestBody = []; + + public function __construct($endpoint, $method = 'POST') + { + // set the default request method + $this->setRequestMethod($method); + + parent::__construct(['base_uri' => StringPlay::removeSlashes($endpoint) . '/']); + } + + public function setRequestMethod($method) + { + $this->_requestMethod = $method; + + return $this; + } + + public function setRequestHeader($header, $value) + { + $this->_requestHeaders[$header] = $value; + + return $this; + } + + public function setRequestAuthKey($auth_key) + { + $this->setRequestHeader('Authorization', 'Bearer ' . $auth_key); + + return $this; + } + + public function setRequestPath($path) + { + $this->_requestPath = $path; + + return $this; + } + + public function setRequestBody(array $request_body) + { + $this->_requestBody = $request_body; + + return $this; + } + + /** + * This method is bound to init the connection to a server + */ + public function connect() + { + $request = new Request($this->_requestMethod, $this->_requestPath, $this->_requestHeaders, $this->_requestBody); + + try { + return $this->send($request); + } catch (GuzzleException $e) { + dump($e); + } + } +} diff --git a/src/Http/ResponseBridge.php b/src/Http/ResponseBridge.php new file mode 100644 index 0000000..39478ed --- /dev/null +++ b/src/Http/ResponseBridge.php @@ -0,0 +1,20 @@ + + * @date 2019-03-11 + */ + +namespace Matscode\Http; + + +class ResponseBridge +{ + public function __construct() + { + + } +} diff --git a/src/Paystack/.gitignore b/src/Paystack/.gitignore new file mode 100644 index 0000000..bfa6a22 --- /dev/null +++ b/src/Paystack/.gitignore @@ -0,0 +1 @@ +# Created by .ignore support plugin (hsz.mobi) diff --git a/src/Paystack/Base.php b/src/Paystack/Base.php new file mode 100644 index 0000000..b4377aa --- /dev/null +++ b/src/Paystack/Base.php @@ -0,0 +1,157 @@ + + * @date 2017-06-26 + * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com) + * + */ + +namespace Matscode\Paystack; + +use Matscode\Http\RequestBridge; +use Matscode\Utility\StringPlay; + +class Base +{ + + private + $_apiBaseUrl = 'https://api.paystack.co/', // with trailing slash + $_curl, + $_requestBridge, + $_secretKey, + + /*Getting Error Infomation*/ + $_errorMessages = []; + + public + $resource, + $action, + $args = [], + $data, + // response from the endpoint + $response; + + public function __construct($secretKey) + { + { + // register an error handler + $whoops = new \Whoops\Run; + $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler); + $whoops->register(); + } + + // TODO: Get auth key from .env + $this->_secretKey = $secretKey; + $this->_requestBridge = new RequestBridge($this->_apiBaseUrl); + $this->_requestBridge->setRequestAuthKey($this->_secretKey); + + return $this; + } + + public function setAction($action) + { + return $this->action = StringPlay::removeSlashes($action); + } + + public function getAction() + { + return $this->action; + } + + public function setResource($resource) + { + return $this->resource = StringPlay::removeSlashes($resource); + } + + public function getResource() + { + return $this->resource; + } + + public function setArgs(array $args) + { + $this->args = $args; + } + + /** + * Join keywords intended to be appended to the endpoint w/ a suffixed forward slash + * + * @return string + */ + private function getParseArgs() + { + if (count($this->args)) { + return '/' . implode('/', $this->args); + } + // return empty string + return ''; + } + + /** + * Initiate Request to the paystack RESTful API and return response Obj + * + * @param array $withData + * @param string $requestMethod + * @param bool $returnArray set to true to return response as associate array + * + * @return mixed + * @throws \Exception + */ + public function sendRequest(array $withData = [], $requestMethod = 'POST', $returnArray = false) + { + $this->data = $withData; + + $uriPath = $this->getResource() . '/' . $this->getAction() . $this->getParseArgs(); + + dump($this->data); + // send the request and return result as json object + $response = $this->_requestBridge->setRequestPath($uriPath)->setRequestBody($this->data)->connect(); + + // $this->_curl = (new CURL($this->_endPoint, $requestMethod)) + // ->setRequestHeader('Authorization', 'Bearer ' . $this->_secretKey); + + // $this->response = json_decode($this->_curl->run($this->data, 'json')); + + return $this->response; + } + + /** + * @param mixed $errorMessages + */ + public function setErrorMessages($errorMessages) + { + //if errorMessages is string + if (is_string($errorMessages)) { + $this->_errorMessages[] = $errorMessages; + } + //if errorMessages is array + if (is_array($errorMessages)) { + $this->_errorMessages = array_merge($this->_errorMessages, $errorMessages); + } + } + + /** + * @param bool $toString + * @param string $delimiter + * + * @return array|string + */ + public function getErrorMessages($toString = false, $delimiter = '
') + { + $errorMessages = $this->_errorMessages; + if ($toString) { + // return errorMessage as String + unset($errorMessages); //to avoid datatype conflict + $errorMessages = join($delimiter, $this->_errorMessages); + } + + return $errorMessages; + } + + +} diff --git a/src/Paystack/Transaction.php b/src/Paystack/Transaction.php new file mode 100644 index 0000000..acab585 --- /dev/null +++ b/src/Paystack/Transaction.php @@ -0,0 +1,287 @@ + + * @date 2017-06-25 + * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com) + * + */ + +namespace Matscode\Paystack; + + +use Matscode\Utility\StringPlay; + +class Transaction extends Base +{ + public + $amount = 0, + $email = null, + $reference = null, + $transactionResponse = + [ + 'verify' => null, + 'initialize' => null + ]; + + private + $_callbackUrl = null; + + + public function __construct($secretKey = null) + { + if (!is_null($secretKey)) { + parent::__construct($secretKey); + } + // set the default resource for current class + $this + ->setResource('transaction'); + + return $this; + } + + /** + * This method must be called to request for payment. which return an initial transaction obj + * + * @param array $data + * @param bool $rawResponse + * + * @return mixed|\stdClass + * @throws \Exception + */ + public function initialize(array $data = [], $rawResponse = false) + { + // values set via mutator + $data['callback_url'] = $this->_callbackUrl; + + // override refernce $data['reference'] value + if ($this->reference) { + $data['reference'] = $this->reference; + } elseif (!isset($data['reference'])) { + $this->reference = $data['reference'] = StringPlay::uniqueRef(); + } else { + $this->reference = $data['reference']; + } + + // override amount $data['amount'] value + if ($this->amount) { + $data['amount'] = $this->amount; + } else { + // save amount in memory + $this->amount = $data['amount']; + } + + // override email $data['email'] value + if (!is_null($this->email)) { + $data['email'] = $this->email; + } else { + // save amount in memory + $this->email = $data['email']; + } + + $this->setAction('initialize'); + $this->transactionResponse['initialize'] = $this->sendRequest($data); + + if ($rawResponse) { + $response = + $this->transactionResponse['initialize']; + } else { + // Initialize a new Obj to save Striped response + $response = new \stdClass(); + if (isset($this->transactionResponse['initialize']->data) && + is_object($this->transactionResponse['initialize']->data) + ) { + $response->authorizationUrl = $this->transactionResponse['initialize']->data->authorization_url; + $response->reference = $this->transactionResponse['initialize']->data->reference; + } else { + // return the raw response + $response = + $this->transactionResponse['initialize']; + } + } + + return $response; + } + + /** + * Is used to Check if a transaction is successful and return the transaction object data + * + * @param null $reference + * + * @return mixed + * @throws \GuzzleHttp\Exception\GuzzleException + * @todo Use session to keep reference temporary per transaction To enhance Transaction reference guessing. + * + */ + public function verify($reference = null) + { + // try to guess reference if not set + if (is_null($reference)) { + // guess reference + if (isset($_GET['reference'])) { + $reference = $_GET['reference']; + } else { + // return false + return false; + } + } + + $this->transactionResponse['verify'] = + $this + ->setAction('verify', [$reference]) + ->sendRequest([], 'GET'); + + return $this->transactionResponse['verify']; + } + + /** + * Like verify(), but it only checks to see if a transactions is successful returning boolean + * + * @param null $reference + * + * @return bool + * @throws \Exception + */ + public function isSuccessful($reference = null) + { + // get verify response + $response = $this->verify($reference); + + // Initialize as !isSuccessful + $isSuccessful = false; + + // check if transaction is successful + if (isset($response->data) && is_object($response->data) && + $response->status == true && + $response->data->status == 'success' + ) { + $isSuccessful = true; + } + + return $isSuccessful; + } + + /** + * Compares the amount paid by customer to the amount passed into it + * + * @param $amountExpected + * + * @return bool + */ + public function amountEquals($amountExpected) + { + // $this->verify(); // call verify() or isSuccessful() before calling this method + $transactionResponse = $this->transactionResponse['verify']; + if (is_object($transactionResponse)) { + return + ((int)$transactionResponse->data->amount === $amountExpected); + } + + return false; + } + + /** + * @param null $reference + * + * @return string|null + * @throws \Exception + */ + public function getAuthorizationCode($reference = null) + { + $authorizationCode = null; + // get verify response + if ($this->isSuccessful($reference)) { + $response = $this->verify($reference); + $authorizationCode = $response->data->authorization->authorization_code; + } + + return $authorizationCode; + } + + /** + * @param $email + * + * @return $this + */ + public function setEmail($email) + { + // setting the email + $this->email = $email; + + return $this; + } + + public function getEmail($email) + { + // setting the email + $this->email = $email; + } + + /** + * @param int $amount + * + * @todo Allow to set kobo using '.' syntax + * @return $this + */ + public function setAmount($amount) + { + // setting amount in naira //TODO: Allow to set kobo using '.' syntax + $this->amount = ($amount * 100); + + return $this; + } + + /** + * @return int + */ + public function getAmount() + { + return $this->amount; + } + + /** + * Sets the transaction reference code/id + * + * @param null $reference + */ + public function setReference($reference) + { + $this->reference = $reference; + } + + /** + * @param bool $afterInitialize + * + * @return null + * + */ + public function getReference($afterInitialize = false) + { + if ($afterInitialize) { + $reference = $this->response->data->reference; + } else { + $reference = $this->reference; + } + + return $reference; + } + + /** + * To set callback URL, can be used to override callback URL set on paystack dashboard + * + * @param string $callbackUrl + * + * @return $this + */ + public function setCallbackUrl($callbackUrl) + { + $this->_callbackUrl = $callbackUrl; + + return $this; + } + +} diff --git a/src/Transaction.php b/src/Transaction.php deleted file mode 100644 index 8f4cb4c..0000000 --- a/src/Transaction.php +++ /dev/null @@ -1,287 +0,0 @@ - - * @date 2017-06-25 - * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com) - * - */ - - namespace Matscode\Paystack; - - - use Matscode\Paystack\Utility\Text; - - class Transaction extends Base - { - public - $amount = 0, - $email = null, - $reference = null, - $transactionResponse = - [ - 'verify' => null, - 'initialize' => null - ]; - - private - $_callbackUrl = null; - - - public function __construct( $secretKey = null ) - { - if ( ! is_null( $secretKey ) ) { - parent::__construct( $secretKey ); - } - // set the default resource for current class - $this - ->setResource( 'transaction' ); - - return $this; - } - - /** - * This method must be called to request for payment. which return an initial transaction obj - * - * @param array $data - * @param bool $rawResponse - * - * @return mixed|\stdClass - */ - public function initialize( array $data = [], $rawResponse = false ) - { - // values set via mutator - $data['callback_url'] = $this->_callbackUrl; - - // override refernce $data['reference'] value - if ( $this->reference ) { - $data['reference'] = $this->reference; - } elseif ( ! isset( $data['reference'] ) ) { - $this->reference = $data['reference'] = Text::uniqueRef(); - } else { - $this->reference = $data['reference']; - } - - // override amount $data['amount'] value - if ( $this->amount ) { - $data['amount'] = $this->amount; - } else { - // save amount in memory - $this->amount = $data['amount']; - } - - // override email $data['email'] value - if ( ! is_null( $this->email ) ) { - $data['email'] = $this->email; - } else { - // save amount in memory - $this->email = $data['email']; - } - - $this->transactionResponse['initialize'] = - $this - ->setAction( 'initialize' ) - ->sendRequest( $data ); - - - if ( $rawResponse ) { - $response = - $this->transactionResponse['initialize']; - } else { - // Initialize a new Obj to save Striped response - $response = new \stdClass(); - if ( isset( $this->transactionResponse['initialize']->data ) && - is_object( $this->transactionResponse['initialize']->data ) - ) { - $response->authorizationUrl = $this->transactionResponse['initialize']->data->authorization_url; - $response->reference = $this->transactionResponse['initialize']->data->reference; - } else { - // return the raw response - $response = - $this->transactionResponse['initialize']; - } - } - - return $response; - } - - /** - * Is used to Check if a transaction is successful and return the transaction object datd - * - * @param null $reference - * - * @todo Use session to keep reference temporary per transaction To enhance Transaction reference guessing. - * - * @return mixed - * @throws \Exception - */ - public function verify( $reference = null ) - { - // try to guess reference if not set - if ( is_null( $reference ) ) { - // guess reference - if ( isset( $_GET['reference'] ) ) { - $reference = $_GET['reference']; - } else { - // return false - return false; - } - } - - $this->transactionResponse['verify'] = - $this - ->setAction( 'verify', [ $reference ] ) - ->sendRequest( [], 'GET' ); - - return $this->transactionResponse['verify']; - } - - /** - * Like verify(), but it only checks to see if a transactions is successful returning boolean - * - * @param null $reference - * - * @return bool - */ - public function isSuccessful( $reference = null ) - { - // get verify response - $response = $this->verify( $reference ); - - // Initialize as !isSuccessful - $isSuccessful = false; - - // check if transaction is successful - if ( isset($response->data) && is_object( $response->data ) && - $response->status == true && - $response->data->status == 'success' - ) { - $isSuccessful = true; - } - - return $isSuccessful; - } - - /** - * Compares the amount paid by customer to the amount passed into it - * - * @param $amountExpected - * - * @return bool - */ - public function amountEquals( $amountExpected ) - { - // $this->verify(); // call verify() or isSuccessful() before calling this method - $transactionResponse = $this->transactionResponse['verify']; - if ( is_object( $transactionResponse ) ) { - return - ( (int) $transactionResponse->data->amount === $amountExpected ); - } - - return false; - } - - /** - * @param null $reference - * - * @return string|null - */ - public function getAuthorizationCode( $reference = null ) - { - $authorizationCode = null; - // get verify response - if ( $this->isSuccessful( $reference ) ) { - $response = $this->verify( $reference ); - $authorizationCode = $response->data->authorization->authorization_code; - } - - return $authorizationCode; - } - - /** - * @param $email - * - * @return $this - */ - public function setEmail( $email ) - { - // setting the email - $this->email = $email; - - return $this; - } - - public function getEmail( $email ) - { - // setting the email - $this->email = $email; - } - - /** - * @param int $amount - * - * @todo Allow to set kobo using '.' syntax - * @return $this - */ - public function setAmount( $amount ) - { - // setting amount in naira //TODO: Allow to set kobo using '.' syntax - $this->amount = ( $amount * 100 ); - - return $this; - } - - /** - * @return int - */ - public function getAmount() - { - return $this->amount; - } - - /** - * Sets the transaction reference code/id - * - * @param null $reference - */ - public function setReference( $reference ) - { - $this->reference = $reference; - } - - /** - * @param bool $afterInitialize - * - * @return null - * - */ - public function getReference( $afterInitialize = false ) - { - if ( $afterInitialize ) { - $reference = $this->response->data->reference; - } else { - $reference = $this->reference; - } - - return $reference; - } - - /** - * To set callback URL, can be used to override callback URL set on paystack dashboard - * - * @param string $callbackUrl - * - * @return $this - */ - public function setCallbackUrl( $callbackUrl ) - { - $this->_callbackUrl = $callbackUrl; - - return $this; - } - - } \ No newline at end of file diff --git a/src/Utility/Debug.php b/src/Utility/Debug.php index f888eaf..95e0bba 100644 --- a/src/Utility/Debug.php +++ b/src/Utility/Debug.php @@ -1,44 +1,57 @@ - * @date 2017-06-27 - * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com) - * - */ +/** + * + * Description + * + * @package Paystack + * @category Source + * @author Michael Akanji + * @date 2017-06-27 + * + */ - namespace Matscode\Paystack\Utility; +namespace Matscode\Utility; +class Debug +{ + private + static + $openTag = '
',
+        $closeTag = '
'; - class Debug - { - private - static - $openTag = '
',
-			$closeTag = '
'; + /** + * @param $value + * + * @deprecated + */ + public static function printStr($value) + { + echo self::$openTag . + $value . + self::$closeTag; + } - public static function printStr( $value ) - { - echo self::$openTag . - $value . - self::$closeTag; - } + /** + * @param $value + * + * @deprecated + */ + public static function print_r($value) + { + echo self::$openTag . + print_r($value, true) . + self::$closeTag; + } - public static function print_r( $value ) - { - echo self::$openTag . - print_r( $value, true ) . - self::$closeTag; - } - - public static function var_dump( $value ) - { - echo self::$openTag; - var_dump( $value ); - echo self::$closeTag; - } - } \ No newline at end of file + /** + * @param $value + * + * @deprecated + */ + public static function var_dump($value) + { + echo self::$openTag; + var_dump($value); + echo self::$closeTag; + } +} diff --git a/src/Utility/Http.php b/src/Utility/Http.php index 36fb25b..b87aff8 100644 --- a/src/Utility/Http.php +++ b/src/Utility/Http.php @@ -7,11 +7,10 @@ * @category Source * @author Michael Akanji * @date 2017-06-27 - * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com) * */ - namespace Matscode\Paystack\Utility; + namespace Matscode\Utility; class Http { @@ -21,4 +20,4 @@ public static function redirect( $location, $replace = true, $httpResponseCode = header( 'Location: ' . $location, $replace, $httpResponseCode ); } - } \ No newline at end of file + } diff --git a/src/Utility/StringPlay.php b/src/Utility/StringPlay.php new file mode 100644 index 0000000..26ef3fb --- /dev/null +++ b/src/Utility/StringPlay.php @@ -0,0 +1,55 @@ + + * @date 2017-06-26 + * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com) + * + */ + +namespace Matscode\Utility; + + +class StringPlay +{ + /** + * + * @author Hackan + * @link https://php.net/manual/en/function.uniqid.php#120123 + * + * @param int $length + * + * @param int $capsMix + * + * @return bool|StringPlay + * @throws \Exception + */ + public static function uniqueRef($length = 15, $capsMix = 5) + { + // uniqid gives 15 chars, but you could adjust it to your needs. + if (function_exists("random_bytes")) { + $bytes = random_bytes(ceil($length / 2)); + } elseif (function_exists("openssl_random_pseudo_bytes")) { + $bytes = openssl_random_pseudo_bytes(ceil($length / 2)); + } else { + throw new \Exception("No cryptographically secure random function available"); + } + + if ($capsMix > 10) { + throw new \Exception('capsMix can not be greater than 10'); + } + $caps = substr(str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 1, $capsMix); + + return str_shuffle(substr(bin2hex($bytes), 0, $length) . $caps); + } + + + public static function removeSlashes($string) + { + return trim($string, '/'); + } +} diff --git a/src/Utility/Text.php b/src/Utility/Text.php deleted file mode 100644 index a2e01a0..0000000 --- a/src/Utility/Text.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @date 2017-06-26 - * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com) - * - */ - - namespace Matscode\Paystack\Utility; - - - class Text - { - /** - * - * @author Hackan - * @link https://php.net/manual/en/function.uniqid.php#120123 - * - * @param int $length - * - * @param int $capsMix - * - * @return bool|string - * @throws \Exception - */ - public static function uniqueRef( $length = 15, $capsMix = 5 ) - { - // uniqid gives 15 chars, but you could adjust it to your needs. - if ( function_exists( "random_bytes" ) ) { - $bytes = random_bytes( ceil( $length / 2 ) ); - } elseif ( function_exists( "openssl_random_pseudo_bytes" ) ) { - $bytes = openssl_random_pseudo_bytes( ceil( $length / 2 ) ); - } else { - throw new \Exception( "No cryptographically secure random function available" ); - } - - if ( $capsMix > 10 ) { - throw new \Exception( 'capsMix can not be greater than 10' ); - } - $caps = substr( str_shuffle( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ), 1, $capsMix ); - - return str_shuffle( substr( bin2hex( $bytes ), 0, $length ) . $caps ); - } - - - public static function removeSlashes( $string ) - { - return trim( $string, '/' ); - } - } \ No newline at end of file diff --git a/test/index.php b/test/index.php deleted file mode 100644 index aefbb1e..0000000 --- a/test/index.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @date 2017-06-26 - * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com) - * - */ - require_once "../vendor/autoload.php"; - - use Matscode\Paystack\Transaction; - use Matscode\Paystack\Utility\Debug; - use Matscode\Paystack\Utility\Http; - - $secretKey = 'sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; - - // creating the transaction object - $Transaction = new Transaction( $secretKey ); - - // Set data to post using this method - /* - $response = $Transaction->initialize( [ - 'email' => 'customer@email.com', - 'amount' => 500000 - ] ); - */ - - // OR - - $response = - $Transaction - ->setEmail( 'matscode@gmail.com' ) - ->setAmount( 50 ) - ->initialize(); - - // print response - Debug::print_r( $response ); - - // save reference somewhere and do a redirect - Http::redirect($response->authorizationUrl); - diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..bfa6a22 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +# Created by .ignore support plugin (hsz.mobi)