From b439ce4663ea26a3b38975479bfd8f72dfe13115 Mon Sep 17 00:00:00 2001 From: "LAPTOP-PLVVCJSK\\Rodrigo" Date: Tue, 20 Mar 2018 21:31:37 +0000 Subject: [PATCH 01/29] simple api call using cUrl --- .gitignore | 1 + demo.php | 12 +++++++++ nbproject/project.properties | 7 +++++ nbproject/project.xml | 9 +++++++ src/AbstractApi.php | 51 ++++++++++++++++++++++++++++++++++++ src/Api.php | 44 +++++++++++++++++++++++++++++++ src/InterfaceApi.php | 21 +++++++++++++++ 7 files changed, 145 insertions(+) create mode 100644 demo.php create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/AbstractApi.php create mode 100644 src/Api.php create mode 100644 src/InterfaceApi.php diff --git a/.gitignore b/.gitignore index a4854be..431ae6b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ Homestead.json # Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer .rocketeer/ +/nbproject/private/ \ No newline at end of file diff --git a/demo.php b/demo.php new file mode 100644 index 0000000..58de659 --- /dev/null +++ b/demo.php @@ -0,0 +1,12 @@ + 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => newsapi , 'limit'=> 50)); +$api->getData(); \ No newline at end of file diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..76f6f91 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,7 @@ +include.path=${php.global.include.path} +php.version=PHP_56 +source.encoding=UTF-8 +src.dir=. +tags.asp=false +tags.short=false +web.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..513cacb --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,9 @@ + + + org.netbeans.modules.php.project + + + News-API-php + + + diff --git a/src/AbstractApi.php b/src/AbstractApi.php new file mode 100644 index 0000000..396ca7b --- /dev/null +++ b/src/AbstractApi.php @@ -0,0 +1,51 @@ + $this->url, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "UTF-8", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "GET", + CURLOPT_HTTPHEADER => array( + "Cache-Control: no-cache", + ), + )); + + $response = curl_exec($curl); + $err = curl_error($curl); + + curl_close($curl); + + $this->setData($response); + + if ($err) { + throw new \Exception("cURL Error #:" . $err); + } + } + + public function getData() { + return $this->data; + } + + private function setData($data) { + $this->data = json_decode($data); + } + +} diff --git a/src/Api.php b/src/Api.php new file mode 100644 index 0000000..06851d3 --- /dev/null +++ b/src/Api.php @@ -0,0 +1,44 @@ +url = URL . $type . "?{$uri}"; + + //execute + $this->call(); + + } + + +} diff --git a/src/InterfaceApi.php b/src/InterfaceApi.php new file mode 100644 index 0000000..4e404ac --- /dev/null +++ b/src/InterfaceApi.php @@ -0,0 +1,21 @@ + Date: Tue, 20 Mar 2018 21:40:35 +0000 Subject: [PATCH 02/29] add composer --- .gitignore | 3 ++- composer.json | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 composer.json diff --git a/.gitignore b/.gitignore index 431ae6b..db7da77 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,5 @@ Homestead.json # Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer .rocketeer/ -/nbproject/private/ \ No newline at end of file +/nbproject/private/ +/nbproject/ \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..55cb492 --- /dev/null +++ b/composer.json @@ -0,0 +1,17 @@ +{ + "name": "rmanara/news-api-php", + "description": "Api call for newFeed", + "type": "library", + "authors": [ + { + "name": "Rodrigo Manara", + "email": "me@rodrigomanara.co.uk" + } + ], + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "NewsApi\\": "src/" + } + } +} From 725d331455c33cf3673beba002e2246ced4dfc7f Mon Sep 17 00:00:00 2001 From: "LAPTOP-PLVVCJSK\\Rodrigo" Date: Tue, 20 Mar 2018 21:44:43 +0000 Subject: [PATCH 03/29] remove extra para demo --- demo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo.php b/demo.php index 58de659..e418db5 100644 --- a/demo.php +++ b/demo.php @@ -8,5 +8,5 @@ require_once './src/Api.php'; -$api = new \NewsApi\Api( array('q' => 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => newsapi , 'limit'=> 50)); +$api = new \NewsApi\Api( array('q' => 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => newsapi)); $api->getData(); \ No newline at end of file From d4ceac64f48dc464653ba5f3812d5e22f26ae173 Mon Sep 17 00:00:00 2001 From: "LAPTOP-PLVVCJSK\\Rodrigo" Date: Tue, 20 Mar 2018 21:46:31 +0000 Subject: [PATCH 04/29] remove ide config --- nbproject/project.properties | 7 ------- nbproject/project.xml | 9 --------- 2 files changed, 16 deletions(-) delete mode 100644 nbproject/project.properties delete mode 100644 nbproject/project.xml diff --git a/nbproject/project.properties b/nbproject/project.properties deleted file mode 100644 index 76f6f91..0000000 --- a/nbproject/project.properties +++ /dev/null @@ -1,7 +0,0 @@ -include.path=${php.global.include.path} -php.version=PHP_56 -source.encoding=UTF-8 -src.dir=. -tags.asp=false -tags.short=false -web.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml deleted file mode 100644 index 513cacb..0000000 --- a/nbproject/project.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - org.netbeans.modules.php.project - - - News-API-php - - - From 93e309b4bacabbb6e81a1628cba0ade769b1e7d6 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 20 Mar 2018 21:47:41 +0000 Subject: [PATCH 05/29] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6b84375..35d3284 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # News API SDK for PHP -Coming soon... this is where our officially supported SDK for PHP is going to live. -*** -## Developers... we need you! -We need some help fleshing out this repo. If you're a PHP dev with experience building Composer-compatible libraries and web API wrappers, we're offering a reward of $250 to help us get started. For more info please email support@newsapi.org, or dive right in and send us a pull request. +require_once './src/Api.php'; + +$api = new \NewsApi\Api( array('q' => 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => newsapi)); +$api->getData(); From d6974f9461ff9a1f83563344371323af1919de1e Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 20 Mar 2018 21:51:09 +0000 Subject: [PATCH 06/29] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 35d3284..8b039c0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ -# News API SDK for PHP +# News API SDK for PHP +Search through millions of articles from over 30,000 large and small news sources and blogs. This includes breaking news as well as lesser articles. + +# Example require_once './src/Api.php'; From 873fa00338a906101b3bf8190955b41f04f77bc0 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 20 Mar 2018 21:53:29 +0000 Subject: [PATCH 07/29] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 8b039c0..196258f 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,6 @@ require_once './src/Api.php'; $api = new \NewsApi\Api( array('q' => 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => newsapi)); $api->getData(); + +# Composer install +composer require rmanara/news-api-php From 08e4fe2236537e88ae70ec30835f755c9101e1fe Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 20 Mar 2018 21:56:16 +0000 Subject: [PATCH 08/29] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 196258f..feb8ca7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # News API SDK for PHP Search through millions of articles from over 30,000 large and small news sources and blogs. This includes breaking news as well as lesser articles. +find out more about it: [documentation](https://newsapi.org/docs/) # Example @@ -9,5 +10,8 @@ require_once './src/Api.php'; $api = new \NewsApi\Api( array('q' => 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => newsapi)); $api->getData(); + # Composer install -composer require rmanara/news-api-php + +> composer require rmanara/news-api-php + From bc2e16b5f0cb1607c76cc8f286c0c71958437627 Mon Sep 17 00:00:00 2001 From: "LAPTOP-PLVVCJSK\\Rodrigo" Date: Wed, 21 Mar 2018 07:27:44 +0000 Subject: [PATCH 09/29] add changes and fix issue on interface --- demo.php | 9 ++++++--- src/AbstractApi.php | 7 +++---- src/Api.php | 6 +++--- src/InterfaceApi.php | 5 ++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/demo.php b/demo.php index e418db5..5d83644 100644 --- a/demo.php +++ b/demo.php @@ -6,7 +6,10 @@ * and open the template in the editor. */ -require_once './src/Api.php'; +require_once './vendor/autoload.php'; -$api = new \NewsApi\Api( array('q' => 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => newsapi)); -$api->getData(); \ No newline at end of file +$api = new \NewsApi\Api( array('q' => 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => '')); +$data = $api->getData(); + + +var_dump($data); \ No newline at end of file diff --git a/src/AbstractApi.php b/src/AbstractApi.php index 396ca7b..fadf9a7 100644 --- a/src/AbstractApi.php +++ b/src/AbstractApi.php @@ -8,15 +8,14 @@ * @author Rodrigo */ class AbstractApi implements InterfaceApi { + - public $url; - - protected function call() { + protected function call($url) { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => $this->url, + CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "UTF-8", CURLOPT_MAXREDIRS => 10, diff --git a/src/Api.php b/src/Api.php index 06851d3..9571c00 100644 --- a/src/Api.php +++ b/src/Api.php @@ -30,13 +30,13 @@ class Api extends AbstractApi { * @param type $query * @param type TOP_HEADLINE | EVERYTHING | SOURCES */ - public function __construct($query = array() , $type = TOP_HEADLINE ) { + public function __construct($query = array() , $type = self::TOP_HEADLINE ) { $uri = http_build_query($query); - $this->url = URL . $type . "?{$uri}"; + $url = self::URL . $type . "?{$uri}"; //execute - $this->call(); + $this->call($url); } diff --git a/src/InterfaceApi.php b/src/InterfaceApi.php index 4e404ac..7416616 100644 --- a/src/InterfaceApi.php +++ b/src/InterfaceApi.php @@ -13,9 +13,8 @@ * * @author Rodrigo */ -class InterfaceApi { +interface InterfaceApi { - - public function call(); + public function getData(); } From b5f81e716b6aff7fcc5bee4c22894c3b8738dc46 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Wed, 21 Mar 2018 17:20:29 +0000 Subject: [PATCH 10/29] add validation on apikey --- composer.json | 3 + composer.lock | 1472 +++++++++++++++++++++++++++++++++++++++++++ src/AbstractApi.php | 49 +- src/Api.php | 28 +- 4 files changed, 1529 insertions(+), 23 deletions(-) create mode 100644 composer.lock diff --git a/composer.json b/composer.json index 55cb492..31f33a3 100644 --- a/composer.json +++ b/composer.json @@ -13,5 +13,8 @@ "psr-4": { "NewsApi\\": "src/" } + }, + "require-dev": { + "phpunit/phpunit": "^7.0" } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..9bc0d66 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1472 @@ +{ + "_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#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "a66cec00524c9d0c182e1eddfe6a0876", + "packages": [], + "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": "myclabs/deep-copy", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.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": "2017-10-19T19:58:43+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "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": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "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": "2017-03-05T17:38:23+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.7.5", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/dfd6be44111a7c41c2e884a336cc4f461b3b2401", + "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401", + "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", + "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" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.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-02-19T10:16:54+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "f8ca4b604baf23dab89d87773c28cc07405189ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f8ca4b604baf23dab89d87773c28cc07405189ba", + "reference": "f8ca4b604baf23dab89d87773c28cc07405189ba", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.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": "2018-02-02T07:01:41+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.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": "2017-11-27T13:52:08+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.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "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", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2018-02-01T13:07:23+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "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-02-01T13:16:43+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "e2f8aa21bc54b6ba218bdd4f9e0dac1e9bc3b4e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e2f8aa21bc54b6ba218bdd4f9e0dac1e9bc3b4e9", + "reference": "e2f8aa21bc54b6ba218bdd4f9e0dac1e9bc3b4e9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0", + "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.0", + "phpunit/phpunit-mock-objects": "^6.0", + "sebastian/comparator": "^2.1", + "sebastian/diff": "^3.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "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": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2018-02-26T07:03:12+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "e3249dedc2d99259ccae6affbc2684eac37c2e53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/e3249dedc2d99259ccae6affbc2684eac37c2e53", + "reference": "e3249dedc2d99259ccae6affbc2684eac37c2e53", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.5", + "php": "^7.1", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.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": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2018-02-15T05:27:38+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/comparator", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/diff": "^2.0 || ^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.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" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-02-01T13:46:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/e09160918c66281713f1c324c1f4c4c3037ba1e8", + "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.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": "2018-02-01T13:45:15+00:00" + }, + { + "name": "sebastian/environment", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.1" + }, + "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": "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": "2017-07-01T08:51:00+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/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "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": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+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/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": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.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": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+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": "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.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "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-01-29T19:49:41+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/src/AbstractApi.php b/src/AbstractApi.php index fadf9a7..c86319d 100644 --- a/src/AbstractApi.php +++ b/src/AbstractApi.php @@ -8,10 +8,17 @@ * @author Rodrigo */ class AbstractApi implements InterfaceApi { - + + private $data; + + const NEWSAPI = ''; + const URL = 'https://newsapi.org/v2/'; + const TOP_HEADLINE = 'top-headlines'; + const EVERYTHING = 'everything'; + const SOURCES = 'sources'; protected function call($url) { - + $curl = curl_init(); curl_setopt_array($curl, array( @@ -23,7 +30,7 @@ protected function call($url) { CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array( - "Cache-Control: no-cache", + "Cache-Control: no-cache", ), )); @@ -43,8 +50,40 @@ public function getData() { return $this->data; } - private function setData($data) { - $this->data = json_decode($data); + protected function setData($data, $encode = true) { + + if ($encode) { + $this->data = json_decode($data); + } else { + + foreach($data as $key => $value){ + $this->data[$key] = $value; + } + + } + } + + /** + * + * @param type $query + * @return type + */ + protected function validate($query) { + + + $validate = (in_array('apiKey', $query) && isset($query['apiKey']) && !empty($query['apiKey'])) ? false : true; + if ($validate) { + $obj = ['error' => ['apikey' => 'missing apikey']]; + $this->setData($obj, false); + } + + $validate = (isset($query['type']) && (self::TOP_HEADLINE == $query['type'] || self::SOURCES == $query['type'] || self::EVERYTHING == $query['type'])) ? false : true; + if ($validate) { + $obj = ['error' => ['type' => 'type is not correct']]; + $this->setData($obj, false); + } + + return $validate; } } diff --git a/src/Api.php b/src/Api.php index 9571c00..6e9395b 100644 --- a/src/Api.php +++ b/src/Api.php @@ -15,30 +15,22 @@ */ class Api extends AbstractApi { -//put your code here - - - const NEWSAPI = ''; - const URL = 'https://newsapi.org/v2/'; - const TOP_HEADLINE = 'top-headlines'; - const EVERYTHING = 'everything'; - const SOURCES = 'sources'; - - /** * * @param type $query * @param type TOP_HEADLINE | EVERYTHING | SOURCES */ - public function __construct($query = array() , $type = self::TOP_HEADLINE ) { - + public function __construct($query = array(), $type = self::TOP_HEADLINE) { + $uri = http_build_query($query); - $url = self::URL . $type . "?{$uri}"; - - //execute - $this->call($url); + $url = self::URL . $type . "?{$uri}"; + + if ($this->validate($query) && $this->validate(['type' => $type])) { + //execute + $this->call($url); + } } - - + + } From 5afc1ee564cd3087c3f041e859cc7fdd21101012 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 23 Jul 2019 08:05:36 +0100 Subject: [PATCH 11/29] Create .travis.yml --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..01ae7ac --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: php +php: + - '7.3' +sudo: required +before_script: + - composer install --prefer-source +notifications: + email: + - me@rodrigomanara.co.uk From 2a7d187e618bb81edc4f0c2f98f00b72103b9664 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 23 Jul 2019 08:06:20 +0100 Subject: [PATCH 12/29] Create testApi.php --- test/testApi.php | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 test/testApi.php diff --git a/test/testApi.php b/test/testApi.php new file mode 100644 index 0000000..4989bea --- /dev/null +++ b/test/testApi.php @@ -0,0 +1,2 @@ + Date: Tue, 23 Jul 2019 08:07:21 +0100 Subject: [PATCH 13/29] Create phpunit.xml --- phpunit.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 phpunit.xml diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..59c2d17 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,20 @@ + + + + + ./test/ + + + + From 04a6ca7e101237bd0d635658ef2f03a8cc2a48e4 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 23 Jul 2019 08:12:11 +0100 Subject: [PATCH 14/29] Update phpunit.xml --- phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index 59c2d17..572e602 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ Date: Tue, 23 Jul 2019 10:01:16 +0100 Subject: [PATCH 15/29] add changes on test --- src/AbstractApi.php | 29 ++++++++++++++++++++-------- src/Api.php | 3 +-- test/testApi.php | 46 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 67 insertions(+), 11 deletions(-) diff --git a/src/AbstractApi.php b/src/AbstractApi.php index c86319d..ef96d2f 100644 --- a/src/AbstractApi.php +++ b/src/AbstractApi.php @@ -11,7 +11,7 @@ class AbstractApi implements InterfaceApi { private $data; - const NEWSAPI = ''; + const NEWSAPI = 'cec26d4a3d9d4aeaa7684ec614575317'; const URL = 'https://newsapi.org/v2/'; const TOP_HEADLINE = 'top-headlines'; const EVERYTHING = 'everything'; @@ -68,17 +68,30 @@ protected function setData($data, $encode = true) { * @param type $query * @return type */ - protected function validate($query) { + protected function validateQuery($query) { - - $validate = (in_array('apiKey', $query) && isset($query['apiKey']) && !empty($query['apiKey'])) ? false : true; - if ($validate) { + $validate = (key_exists('apiKey', $query) && isset($query['apiKey']) && !empty($query['apiKey'])) ? true : false; + if (!$validate) { $obj = ['error' => ['apikey' => 'missing apikey']]; $this->setData($obj, false); - } + } + + + return $validate; + } + + + /** + * + * @param type $query + * @return type + */ + protected function validateType($query) { + + - $validate = (isset($query['type']) && (self::TOP_HEADLINE == $query['type'] || self::SOURCES == $query['type'] || self::EVERYTHING == $query['type'])) ? false : true; - if ($validate) { + $validate = (isset($query['type']) && ((self::TOP_HEADLINE == $query['type'] || self::SOURCES == $query['type'] || self::EVERYTHING == $query['type']))) ? true : false; + if (!$validate) { $obj = ['error' => ['type' => 'type is not correct']]; $this->setData($obj, false); } diff --git a/src/Api.php b/src/Api.php index 6e9395b..35be9c3 100644 --- a/src/Api.php +++ b/src/Api.php @@ -24,9 +24,8 @@ public function __construct($query = array(), $type = self::TOP_HEADLINE) { $uri = http_build_query($query); $url = self::URL . $type . "?{$uri}"; - - if ($this->validate($query) && $this->validate(['type' => $type])) { + if ($this->validateQuery($query) && $this->validateType(['type' => $type])) { //execute $this->call($url); } diff --git a/test/testApi.php b/test/testApi.php index 4989bea..fbba31b 100644 --- a/test/testApi.php +++ b/test/testApi.php @@ -1,2 +1,46 @@ -getData(); + $this->assertEquals($data['error']['apikey'], 'missing apikey'); + } + /** + * + * @return void + */ + public function testwithKeywithoutrequiredParametersApiCall(): void { + $new = new Api([ + 'apiKey' => Api::NEWSAPI + ]); + $data = $new->getData(); + + + $this->assertEquals($data->status, 'error'); + } + /** + * + * @return void + */ + public function testwithKeywithrequiredParametersApiCall(): void { + $new = new Api([ + 'apiKey' => Api::NEWSAPI, + 'language' => 'pt' + ]); + $data = $new->getData(); + + $this->assertEquals($data->status, 'ok'); + } + +} From 0cce3fa3aee112cdf03705191e3e81462ac5c124 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 23 Jul 2019 10:06:27 +0100 Subject: [PATCH 16/29] fix path --- phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index 572e602..6f5879e 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ Date: Tue, 23 Jul 2019 10:10:19 +0100 Subject: [PATCH 17/29] fix path --- phpunit.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index 6f5879e..b1ffe60 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,5 @@ Date: Tue, 23 Jul 2019 10:17:08 +0100 Subject: [PATCH 18/29] fix phpunit --- phpunit.xml | 2 +- test/testApi.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index b1ffe60..7ef1bca 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -12,7 +12,7 @@ verbose="true"> - ./test/ + ./test/testApi.php diff --git a/test/testApi.php b/test/testApi.php index fbba31b..8f04bb0 100644 --- a/test/testApi.php +++ b/test/testApi.php @@ -6,7 +6,7 @@ use NewsApi\Api; -final class NewsApiTest extends PHPUnit\Framework\TestCase { +final class testApi extends PHPUnit\Framework\TestCase { /** * * @return void From dbf6e1ac9f701808e6f97e88473a7697beade651 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 23 Jul 2019 10:18:44 +0100 Subject: [PATCH 19/29] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index feb8ca7..df870f8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/rodrigomanara/News-API-php.svg?branch=master)](https://travis-ci.org/rodrigomanara/News-API-php.svg?branch=master) + # News API SDK for PHP Search through millions of articles from over 30,000 large and small news sources and blogs. This includes breaking news as well as lesser articles. From f2b222c7b1ca208fc81c6ee0319b1ef053a10399 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 23 Jul 2019 10:20:12 +0100 Subject: [PATCH 20/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index df870f8..0c99429 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ find out more about it: [documentation](https://newsapi.org/docs/) # Example -require_once './src/Api.php'; +require_once __DIR__ . '/../vendor/autoload.php'; $api = new \NewsApi\Api( array('q' => 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => newsapi)); $api->getData(); From a857fe30454d0c4e2d1d2494c8421a4cabeda517 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 23 Jul 2019 10:20:59 +0100 Subject: [PATCH 21/29] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0c99429..6cf1871 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,13 @@ Search through millions of articles from over 30,000 large and small news source find out more about it: [documentation](https://newsapi.org/docs/) # Example - +``` require_once __DIR__ . '/../vendor/autoload.php'; $api = new \NewsApi\Api( array('q' => 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => newsapi)); -$api->getData(); +$api->getData(); +``` # Composer install From 2e81ef6818284c20eef2b0d3a104b2ccb92842d0 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Tue, 23 Jul 2019 11:57:21 +0100 Subject: [PATCH 22/29] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 6cf1871..e981105 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ [![Build Status](https://travis-ci.org/rodrigomanara/News-API-php.svg?branch=master)](https://travis-ci.org/rodrigomanara/News-API-php.svg?branch=master) +[![Latest Stable Version](https://poser.pugx.org/rmanara/News-API-php/v/stable)](https://packagist.org/packages/rmanara/News-API-php) +[![License](https://poser.pugx.org/rmanara/News-API-php/license)](https://packagist.org/packages/rmanara/News-API-php) +[![Latest Unstable Version](https://poser.pugx.org/rmanara/News-API-php/v/unstable)](https://packagist.org/packages/rmanara/News-API-php) + + # News API SDK for PHP From 3689e86f395b67245b4e568a4b845d9fb8746836 Mon Sep 17 00:00:00 2001 From: Rodrigo Manara Date: Sat, 21 Dec 2019 10:26:08 +0000 Subject: [PATCH 23/29] Create php.yml --- .github/workflows/php.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..8e856b8 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,23 @@ +name: PHP Composer + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" + # Docs: https://getcomposer.org/doc/articles/scripts.md + + # - name: Run test suite + # run: composer run-script test From 58071e6505c37229b55af6e72651eae252c1e20f Mon Sep 17 00:00:00 2001 From: codediesel Date: Wed, 1 Apr 2026 21:00:36 +0100 Subject: [PATCH 24/29] Update composer require command for news-api-php --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e981105..790b11e 100644 --- a/README.md +++ b/README.md @@ -21,5 +21,5 @@ $api->getData(); # Composer install -> composer require rmanara/news-api-php +> composer require rmanara/news-api-php:dev-master From a2cedce771614f5b2d1567b07b486683b162d328 Mon Sep 17 00:00:00 2001 From: codediesel Date: Thu, 2 Apr 2026 20:52:50 +0000 Subject: [PATCH 25/29] implementations --- .idea/.gitignore | 10 + .idea/News-API-php.iml | 34 ++ .idea/copilotDiffState.xml | 54 ++ .idea/laravel-idea.xml | 8 + .idea/modules.xml | 8 + .idea/php.xml | 70 +++ .idea/vcs.xml | 7 + .phpunit.result.cache | 1 + README.md | 2 +- composer.json | 44 +- composer.lock | 1068 ++++++++++++++++++------------------ demo.php | 18 +- phpunit.xml | 2 +- src/AbstractApi.php | 225 ++++++-- src/Api.php | 71 ++- src/InterfaceApi.php | 30 +- src/enumType.php | 44 ++ test/testApi.php | 67 ++- 18 files changed, 1118 insertions(+), 645 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/News-API-php.iml create mode 100644 .idea/copilotDiffState.xml create mode 100644 .idea/laravel-idea.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/vcs.xml create mode 100644 .phpunit.result.cache create mode 100644 src/enumType.php diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..ab1f416 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/News-API-php.iml b/.idea/News-API-php.iml new file mode 100644 index 0000000..5ebee77 --- /dev/null +++ b/.idea/News-API-php.iml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copilotDiffState.xml b/.idea/copilotDiffState.xml new file mode 100644 index 0000000..43a3b4a --- /dev/null +++ b/.idea/copilotDiffState.xml @@ -0,0 +1,54 @@ + + + + + + \ No newline at end of file diff --git a/.idea/laravel-idea.xml b/.idea/laravel-idea.xml new file mode 100644 index 0000000..bd941a4 --- /dev/null +++ b/.idea/laravel-idea.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9b0b921 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..253c17f --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..8306744 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.phpunit.result.cache b/.phpunit.result.cache new file mode 100644 index 0000000..b1eb6ee --- /dev/null +++ b/.phpunit.result.cache @@ -0,0 +1 @@ +{"version":1,"defects":{"testApi::testwithKeywithrequiredParametersApiCall":4,"testApi::testwithoutKeyApiCall":4},"times":{"testApi::testwithoutKeyApiCall":0.002,"testApi::testwithKeywithoutrequiredParametersApiCall":0.164,"testApi::testwithKeywithrequiredParametersApiCall":0.002,"testApi::testWithInvalidTypeReturnsError":0.002}} \ No newline at end of file diff --git a/README.md b/README.md index 790b11e..75a8290 100644 --- a/README.md +++ b/README.md @@ -21,5 +21,5 @@ $api->getData(); # Composer install -> composer require rmanara/news-api-php:dev-master +> composer require rmanara/news-api-php:^1.0 diff --git a/composer.json b/composer.json index 31f33a3..e397596 100644 --- a/composer.json +++ b/composer.json @@ -1,20 +1,60 @@ { "name": "rmanara/news-api-php", - "description": "Api call for newFeed", + "description": "PHP SDK for the NewsAPI service", + "version": "1.0.0", "type": "library", + "license": "MIT", + "homepage": "https://github.com/rodrigomanara/News-API-php", + "keywords": [ + "news", + "newsapi", + "sdk", + "api", + "php" + ], "authors": [ { "name": "Rodrigo Manara", "email": "me@rodrigomanara.co.uk" } ], + "support": { + "issues": "https://github.com/rodrigomanara/News-API-php/issues", + "source": "https://github.com/rodrigomanara/News-API-php" + }, "minimum-stability": "stable", + "prefer-stable": true, + "require": { + "php": ">=7.4", + "ext-curl": "*", + "ext-json": "*" + }, "autoload": { "psr-4": { "NewsApi\\": "src/" } }, + "autoload-dev": { + "classmap": [ + "test/" + ] + }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.5.52" + }, + "scripts": { + "test": "vendor/bin/phpunit", + "test:coverage": "vendor/bin/phpunit --coverage-text" + }, + "config": { + "sort-packages": true, + "optimize-autoloader": true, + "preferred-install": "dist", + "allow-plugins": {} + }, + "extra": { + "branch-alias": { + "dev-main": "1.0.x-dev" + } } } diff --git a/composer.lock b/composer.lock index 9bc0d66..c3942e6 100644 --- a/composer.lock +++ b/composer.lock @@ -1,42 +1,40 @@ { "_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#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a66cec00524c9d0c182e1eddfe6a0876", + "content-hash": "2409f98df9a558b4ac750e927a0b5a0f", "packages": [], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -50,47 +48,70 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-12-30T00:15:36+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.7.0", + "version": "1.13.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -104,32 +125,44 @@ "object", "object graph" ], - "time": "2017-10-19T19:58:43+00:00" + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2025-08-01T08:46:24+00:00" }, { "name": "phar-io/manifest", - "version": "1.0.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", - "phar-io/version": "^1.0.1", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -159,24 +192,34 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05T18:14:27+00:00" + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", - "version": "1.0.1", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -206,259 +249,48 @@ } ], "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+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" - } + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "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.7.5", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/dfd6be44111a7c41c2e884a336cc4f461b3b2401", - "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401", - "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", - "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" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.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-02-19T10:16:54+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.0.1", + "version": "7.0.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f8ca4b604baf23dab89d87773c28cc07405189ba" + "reference": "40a4ed114a4aea5afd6df8d0f0c9cd3033097f66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f8ca4b604baf23dab89d87773c28cc07405189ba", - "reference": "f8ca4b604baf23dab89d87773c28cc07405189ba", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/40a4ed114a4aea5afd6df8d0f0c9cd3033097f66", + "reference": "40a4ed114a4aea5afd6df8d0f0c9cd3033097f66", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^1.4.2", + "php": ">=7.2", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", + "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.0-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -484,29 +316,42 @@ "testing", "xunit" ], - "time": "2018-02-02T07:01:41+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.17" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:09:37+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "2.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "69deeb8664f611f156a924154985fbd4911eb36b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/69deeb8664f611f156a924154985fbd4911eb36b", + "reference": "69deeb8664f611f156a924154985fbd4911eb36b", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -521,7 +366,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -531,7 +376,17 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:39:50+00:00" }, { "name": "phpunit/php-text-template", @@ -572,32 +427,36 @@ "keywords": [ "template" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "2.0.0", + "version": "2.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" + "reference": "a691211e94ff39a34811abd521c31bd5b305b0bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/a691211e94ff39a34811abd521c31bd5b305b0bb", + "reference": "a691211e94ff39a34811abd521c31bd5b305b0bb", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -621,33 +480,43 @@ "keywords": [ "timer" ], - "time": "2018-02-01T13:07:23+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:42:41+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.0.0", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace" + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace", - "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -670,53 +539,63 @@ "keywords": [ "tokenizer" ], - "time": "2018-02-01T13:16:43+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "time": "2020-08-04T08:28:15+00:00" }, { "name": "phpunit/phpunit", - "version": "7.0.2", + "version": "8.5.52", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "e2f8aa21bc54b6ba218bdd4f9e0dac1e9bc3b4e9" + "reference": "1015741814413c156abb0f53d7db7bbd03c6e858" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e2f8aa21bc54b6ba218bdd4f9e0dac1e9bc3b4e9", - "reference": "e2f8aa21bc54b6ba218bdd4f9e0dac1e9bc3b4e9", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1015741814413c156abb0f53d7db7bbd03c6e858", + "reference": "1015741814413c156abb0f53d7db7bbd03c6e858", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.5.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", - "phar-io/manifest": "^1.0.1", - "phar-io/version": "^1.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0", - "phpunit/php-file-iterator": "^1.4.3", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.13.4", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=7.2", + "phpunit/php-code-coverage": "^7.0.17", + "phpunit/php-file-iterator": "^2.0.6", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.0", - "phpunit/phpunit-mock-objects": "^6.0", - "sebastian/comparator": "^2.1", - "sebastian/diff": "^3.0", - "sebastian/environment": "^3.1", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", + "phpunit/php-timer": "^2.1.4", + "sebastian/comparator": "^3.0.7", + "sebastian/diff": "^3.0.6", + "sebastian/environment": "^4.2.5", + "sebastian/exporter": "^3.1.8", + "sebastian/global-state": "^3.0.6", + "sebastian/object-enumerator": "^3.0.5", + "sebastian/resource-operations": "^2.0.3", + "sebastian/type": "^1.1.5", "sebastian/version": "^2.0.1" }, - "require-dev": { - "ext-pdo": "*" - }, "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage", + "phpunit/php-invoker": "To allow enforcing time limits" }, "bin": [ "phpunit" @@ -724,7 +603,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "8.5-dev" } }, "autoload": { @@ -750,83 +629,54 @@ "testing", "xunit" ], - "time": "2018-02-26T07:03:12+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "6.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "e3249dedc2d99259ccae6affbc2684eac37c2e53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/e3249dedc2d99259ccae6affbc2684eac37c2e53", - "reference": "e3249dedc2d99259ccae6affbc2684eac37c2e53", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.1", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.52" }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "funding": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2018-02-15T05:27:38+00:00" + "time": "2026-01-27T05:20:18+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54", + "reference": "92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -851,34 +701,44 @@ ], "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" + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:45:45+00:00" }, { "name": "sebastian/comparator", - "version": "2.1.3", + "version": "3.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + "reference": "bc7d8ac2fe1cce229bff9b5fd4efe65918a1ff52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/bc7d8ac2fe1cce229bff9b5fd4efe65918a1ff52", + "reference": "bc7d8ac2fe1cce229bff9b5fd4efe65918a1ff52", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/diff": "^2.0 || ^3.0", + "php": ">=7.1", + "sebastian/diff": "^3.0", "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -891,6 +751,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -902,10 +766,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -915,27 +775,49 @@ "compare", "equality" ], - "time": "2018-02-01T13:46:46+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.7" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" + } + ], + "time": "2026-01-24T09:20:25+00:00" }, { "name": "sebastian/diff", - "version": "3.0.0", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8" + "reference": "98ff311ca519c3aa73ccd3de053bdb377171d7b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/e09160918c66281713f1c324c1f4c4c3037ba1e8", - "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/98ff311ca519c3aa73ccd3de053bdb377171d7b6", + "reference": "98ff311ca519c3aa73ccd3de053bdb377171d7b6", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^7.0", + "phpunit/phpunit": "^7.5 || ^8.0", "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", @@ -954,13 +836,13 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -971,32 +853,45 @@ "unidiff", "unified diff" ], - "time": "2018-02-01T13:45:15+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:16:36+00:00" }, { "name": "sebastian/environment", - "version": "3.1.0", + "version": "4.2.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + "reference": "56932f6049a0482853056ffd617c91ffcc754205" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/56932f6049a0482853056ffd617c91ffcc754205", + "reference": "56932f6049a0482853056ffd617c91ffcc754205", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^6.1" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -1021,29 +916,39 @@ "environment", "hhvm" ], - "time": "2017-07-01T08:51:00+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:49:59+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.0", + "version": "3.1.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + "reference": "64cfeaa341951ceb2019d7b98232399d57bb2296" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64cfeaa341951ceb2019d7b98232399d57bb2296", + "reference": "64cfeaa341951ceb2019d7b98232399d57bb2296", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.2", "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -1061,6 +966,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1069,17 +978,13 @@ "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" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -1088,27 +993,52 @@ "export", "exporter" ], - "time": "2017-04-03T13:19:02+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", + "type": "tidelift" + } + ], + "time": "2025-09-24T05:55:14+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "800689427e3e8cf57a8fe38fcd1d4344c9b2f046" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/800689427e3e8cf57a8fe38fcd1d4344c9b2f046", + "reference": "800689427e3e8cf57a8fe38fcd1d4344c9b2f046", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -1116,7 +1046,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1139,24 +1069,46 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", + "type": "tidelift" + } + ], + "time": "2025-08-10T05:40:12+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.3", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "reference": "ac5b293dba925751b808e02923399fb44ff0d541" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/ac5b293dba925751b808e02923399fb44ff0d541", + "reference": "ac5b293dba925751b808e02923399fb44ff0d541", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.0", "sebastian/object-reflector": "^1.1.1", "sebastian/recursion-context": "^3.0" }, @@ -1186,24 +1138,34 @@ ], "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" + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:54:02+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "1d439c229e61f244ff1f211e5c99737f90c67def" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/1d439c229e61f244ff1f211e5c99737f90c67def", + "reference": "1d439c229e61f244ff1f211e5c99737f90c67def", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" @@ -1231,24 +1193,34 @@ ], "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" + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:56:04+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "8fe7e75986a9d24b4cceae847314035df7703a5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/8fe7e75986a9d24b4cceae847314035df7703a5a", + "reference": "8fe7e75986a9d24b4cceae847314035df7703a5a", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" @@ -1269,14 +1241,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -1284,29 +1256,51 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" + } + ], + "time": "2025-08-10T05:25:53+00:00" }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "72a7f7674d053d548003b16ff5a106e7e0e06eee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/72a7f7674d053d548003b16ff5a106e7e0e06eee", + "reference": "72a7f7674d053d548003b16ff5a106e7e0e06eee", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1326,7 +1320,72 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "support": { + "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:59:09+00:00" + }, + { + "name": "sebastian/type", + "version": "1.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "18f071c3a29892b037d35e6b20ddf3ea39b42874" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/18f071c3a29892b037d35e6b20ddf3ea39b42874", + "reference": "18f071c3a29892b037d35e6b20ddf3ea39b42874", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "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", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/1.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T14:04:07+00:00" }, { "name": "sebastian/version", @@ -1369,27 +1428,31 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/master" + }, "time": "2016-10-03T07:35:21+00:00" }, { "name": "theseer/tokenizer", - "version": "1.1.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": "^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -1409,57 +1472,17 @@ } ], "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.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.3.1" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "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": [ + "funding": [ { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "url": "https://github.com/theseer", + "type": "github" } ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2018-01-29T19:49:41+00:00" + "time": "2025-11-17T20:03:58+00:00" } ], "aliases": [], @@ -1467,6 +1490,11 @@ "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [] + "platform": { + "php": ">=7.1", + "ext-curl": "*", + "ext-json": "*" + }, + "platform-dev": [], + "plugin-api-version": "2.6.0" } diff --git a/demo.php b/demo.php index 5d83644..476c43a 100644 --- a/demo.php +++ b/demo.php @@ -1,14 +1,20 @@ 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => '')); +// The API key is the first argument; query parameters are the second. +// The key is sent via the X-Api-Key header and never appears in the URL. +$api = new \NewsApi\Api('YOUR_API_KEY', ['q' => 'Reino Unido', 'language' => 'pt']); $data = $api->getData(); diff --git a/phpunit.xml b/phpunit.xml index 7ef1bca..ffff040 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -2,13 +2,13 @@ diff --git a/src/AbstractApi.php b/src/AbstractApi.php index ef96d2f..6d066f2 100644 --- a/src/AbstractApi.php +++ b/src/AbstractApi.php @@ -1,102 +1,205 @@ |null + */ + private $data = null; - const NEWSAPI = 'cec26d4a3d9d4aeaa7684ec614575317'; - const URL = 'https://newsapi.org/v2/'; - const TOP_HEADLINE = 'top-headlines'; - const EVERYTHING = 'everything'; - const SOURCES = 'sources'; + /** + * Root URL shared by every NewsAPI v2 endpoint. + * + * The concrete endpoint segment and query string are appended at call time. + */ + protected const URL = 'https://newsapi.org/v2/'; - protected function call($url) { + // ------------------------------------------------------------------------- + // Transport + // ------------------------------------------------------------------------- + /** + * Executes a GET request, authenticates it via the {@code X-Api-Key} request + * header, and stores the decoded JSON payload. + * + * Sending the key in a header rather than a query-string parameter prevents it + * from appearing in server access logs, browser history, and HTTP Referer + * headers — all common sources of unintentional credential exposure. + * + * @param string $url Fully-qualified NewsAPI endpoint URL (without the apiKey + * query parameter). + * @param string $apiKey Developer API key forwarded in the X-Api-Key header. + * + * @return void + * + * @throws \RuntimeException When a cURL handle cannot be initialised. + * @throws \RuntimeException When cURL reports a transport-level error. + */ + protected function call(string $url, string $apiKey = ''): void + { $curl = curl_init(); - curl_setopt_array($curl, array( - CURLOPT_URL => $url, + if ($curl === false) { + throw new \RuntimeException('Failed to initialise a cURL handle.'); + } + + curl_setopt_array($curl, [ + CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "UTF-8", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 30, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "GET", - CURLOPT_HTTPHEADER => array( - "Cache-Control: no-cache", - ), - )); + CURLOPT_ENCODING => 'UTF-8', + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => 'GET', + // Explicitly enforce SSL certificate verification to prevent MITM attacks. + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_HTTPHEADER => [ + 'Cache-Control: no-cache', + // Header-based auth keeps the key out of URLs, logs, and history. + 'X-Api-Key: ' . $apiKey, + ], + ]); $response = curl_exec($curl); - $err = curl_error($curl); - + $err = curl_error($curl); curl_close($curl); - $this->setData($response); - - if ($err) { - throw new \Exception("cURL Error #:" . $err); + // Check for a transport error before attempting to store the response so + // that a failed request does not silently overwrite valid stored data. + if ($err !== '') { + throw new \RuntimeException('cURL transport error: ' . $err); } + + $this->setData((string) $response); } - public function getData() { + // ------------------------------------------------------------------------- + // Data accessors + // ------------------------------------------------------------------------- + + /** + * Returns the decoded response payload, a local validation-error array, or + * null when no request has been attempted yet. + * + * @return object|array|null + */ + public function getData() + { return $this->data; } - protected function setData($data, $encode = true) { - - if ($encode) { - $this->data = json_decode($data); + /** + * Stores API response data on the instance. + * + * When {@code $decode} is true (the default) the value is treated as a raw JSON + * string and decoded before storage. Pass false together with an associative + * array to store a pre-built error payload directly without a JSON round-trip. + * + * @param string|array $data JSON response body or a pre-built + * error payload array. + * @param bool $decode When true, JSON-decode {@code $data} + * before storing it. + * + * @return void + */ + protected function setData($data, bool $decode = true): void + { + if ($decode) { + $this->data = json_decode((string) $data); } else { - - foreach($data as $key => $value){ + foreach ((array) $data as $key => $value) { $this->data[$key] = $value; } - } } + // ------------------------------------------------------------------------- + // Validation helpers + // ------------------------------------------------------------------------- + /** - * - * @param type $query - * @return type + * Guards against a missing or blank API key. + * + * When the key is absent the method stores a local error payload and returns + * false so the caller can short-circuit before making any network request. + * + * @param string $apiKey The developer API key to validate. + * + * @return bool True when the key is non-empty; false otherwise. */ - protected function validateQuery($query) { - - $validate = (key_exists('apiKey', $query) && isset($query['apiKey']) && !empty($query['apiKey'])) ? true : false; - if (!$validate) { - $obj = ['error' => ['apikey' => 'missing apikey']]; + protected function validateApiKey(string $apiKey): bool + { + if (trim($apiKey) === '') { + $obj = ['error' => ['apikey' => 'missing apikey']]; $this->setData($obj, false); - } - - - return $validate; + return false; + } + return true; } - - + /** - * - * @param type $query - * @return type + * Guards against an empty query-parameter array. + * + * Every NewsAPI endpoint requires at least one search criterion in addition to + * the API key, so an empty {@code $query} is rejected before any HTTP request + * is issued. + * + * @param array $query Request parameters (must contain at least + * one entry). + * + * @return bool True when the array is non-empty; false otherwise. */ - protected function validateType($query) { - - + protected function validateQuery(array $query): bool + { + if (empty($query)) { + $obj = ['error' => ['query' => 'empty query']]; + $this->setData($obj, false); + return false; + } + return true; + } - $validate = (isset($query['type']) && ((self::TOP_HEADLINE == $query['type'] || self::SOURCES == $query['type'] || self::EVERYTHING == $query['type']))) ? true : false; - if (!$validate) { + /** + * Guards against an unsupported endpoint type. + * + * Accepted values are the string constants defined on {@see enumType}. + * + * @param string $type Endpoint segment to validate (e.g. {@code "top-headlines"}). + * + * @return bool True when {@code $type} matches a recognised NewsAPI endpoint; + * false otherwise. + */ + protected function validateType(string $type): bool + { + $allowed = [ + enumType::TOP_HEADLINE, + enumType::EVERYTHING, + enumType::SOURCES, + ]; + + if (!in_array($type, $allowed, true)) { $obj = ['error' => ['type' => 'type is not correct']]; $this->setData($obj, false); + return false; } - - return $validate; + return true; } - } diff --git a/src/Api.php b/src/Api.php index 35be9c3..02409a3 100644 --- a/src/Api.php +++ b/src/Api.php @@ -1,35 +1,64 @@ + * $api = new Api('your-api-key', ['q' => 'PHP', 'language' => 'en']); + * $data = $api->getData(); + * * - * @author Rodrigo + * @package NewsApi */ -class Api extends AbstractApi { - +class Api extends AbstractApi +{ /** - * - * @param type $query - * @param type TOP_HEADLINE | EVERYTHING | SOURCES + * Validates the provided credentials and query, then immediately executes the request. + * + * Validation is performed in order: + * 1. The API key must be non-empty. + * 2. The endpoint type must be one of the values defined in {@see enumType}. + * 3. The query array must contain at least one search parameter. + * + * If any guard fails, {@see getData()} will return a local error payload and + * no HTTP request is made. + * + * The API key is transmitted via the {@code X-Api-Key} request header and is + * intentionally kept out of the URL to avoid credential exposure in logs. + * + * @param string $apiKey Developer API key issued by newsapi.org. + * @param array $query Endpoint-specific query parameters + * (e.g. {@code ['q' => 'PHP', 'language' => 'en']}). + * @param string $type Endpoint type; one of the {@see enumType} constants. + * Defaults to {@see enumType::TOP_HEADLINE}. + * + * @throws \RuntimeException When the underlying cURL transport fails. */ - public function __construct($query = array(), $type = self::TOP_HEADLINE) { + public function __construct( + string $apiKey, + array $query = [], + string $type = enumType::TOP_HEADLINE + ) { + if (!$this->validateApiKey($apiKey)) { + return; + } - $uri = http_build_query($query); - $url = self::URL . $type . "?{$uri}"; - - if ($this->validateQuery($query) && $this->validateType(['type' => $type])) { - //execute - $this->call($url); + if (!$this->validateType($type)) { + return; } - } - + if (!$this->validateQuery($query)) { + return; + } + + $uri = http_build_query($query); + $url = self::URL . $type . ($uri !== '' ? '?' . $uri : ''); + + $this->call($url, $apiKey); + } } diff --git a/src/InterfaceApi.php b/src/InterfaceApi.php index 7416616..e495089 100644 --- a/src/InterfaceApi.php +++ b/src/InterfaceApi.php @@ -1,20 +1,28 @@ |null + */ + public function getData(); } diff --git a/src/enumType.php b/src/enumType.php new file mode 100644 index 0000000..1e010c3 --- /dev/null +++ b/src/enumType.php @@ -0,0 +1,44 @@ + 'test']); $data = $new->getData(); - $this->assertEquals($data['error']['apikey'], 'missing apikey'); + + $this->assertEquals('missing apikey', $data['error']['apikey']); } + /** - * + * Confirms that passing an invalid endpoint type stores a local validation error + * without making any network request. + * * @return void */ - public function testwithKeywithoutrequiredParametersApiCall(): void { - $new = new Api([ - 'apiKey' => Api::NEWSAPI - ]); + public function testWithInvalidTypeReturnsError(): void + { + $new = new Api('valid-key', ['q' => 'test'], 'invalid-endpoint'); $data = $new->getData(); - - $this->assertEquals($data->status, 'error'); + $this->assertEquals('type is not correct', $data['error']['type']); } + /** - * + * Confirms that a successful request can be consumed as a decoded response object. + * + * The HTTP call is replaced with a mock that injects a known JSON payload so that + * the test does not depend on network availability or a real API key. + * * @return void */ - public function testwithKeywithrequiredParametersApiCall(): void { - $new = new Api([ - 'apiKey' => Api::NEWSAPI, - 'language' => 'pt' - ]); + public function testwithKeywithrequiredParametersApiCall(): void + { + $new = new class ('test-api-key', ['language' => 'pt']) extends Api { + /** + * Overrides the real HTTP transport with a stub that returns a static payload. + * + * @param string $url The request URL that would have been called. + * @param string $apiKey The API key that would have been forwarded. + * + * @return void + */ + protected function call(string $url, string $apiKey = ''): void + { + $this->setData(json_encode(['status' => 'ok'])); + } + }; + $data = $new->getData(); - $this->assertEquals($data->status, 'ok'); + $this->assertEquals('ok', $data->status); } - } From d4805509f3566be4731b93e4f8829b2afbfe77c8 Mon Sep 17 00:00:00 2001 From: codediesel Date: Thu, 2 Apr 2026 20:58:34 +0000 Subject: [PATCH 26/29] add changes on gitignore --- .gitignore | 4 ++- .idea/.gitignore | 10 ------ .idea/News-API-php.iml | 34 ------------------ .idea/copilotDiffState.xml | 54 ----------------------------- .idea/laravel-idea.xml | 8 ----- .idea/modules.xml | 8 ----- .idea/php.xml | 70 -------------------------------------- .idea/vcs.xml | 7 ---- 8 files changed, 3 insertions(+), 192 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/News-API-php.iml delete mode 100644 .idea/copilotDiffState.xml delete mode 100644 .idea/laravel-idea.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/php.xml delete mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore index db7da77..4f0b2c9 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,6 @@ Homestead.json # Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer .rocketeer/ /nbproject/private/ -/nbproject/ \ No newline at end of file +/nbproject/ + +.idea \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index ab1f416..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Ignored default folder with query files -/queries/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/News-API-php.iml b/.idea/News-API-php.iml deleted file mode 100644 index 5ebee77..0000000 --- a/.idea/News-API-php.iml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copilotDiffState.xml b/.idea/copilotDiffState.xml deleted file mode 100644 index 43a3b4a..0000000 --- a/.idea/copilotDiffState.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/laravel-idea.xml b/.idea/laravel-idea.xml deleted file mode 100644 index bd941a4..0000000 --- a/.idea/laravel-idea.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 9b0b921..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml deleted file mode 100644 index 253c17f..0000000 --- a/.idea/php.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 8306744..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file From 3449e6274ed5f4f13b706a6df229c74d6726aa83 Mon Sep 17 00:00:00 2001 From: codediesel Date: Thu, 2 Apr 2026 21:04:38 +0000 Subject: [PATCH 27/29] update read me --- README.md | 166 ++++++++++++++++++++++++++++++++++++++++++++++---- composer.lock | 6 +- 2 files changed, 156 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 75a8290..47d96e5 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,165 @@ -[![Build Status](https://travis-ci.org/rodrigomanara/News-API-php.svg?branch=master)](https://travis-ci.org/rodrigomanara/News-API-php.svg?branch=master) -[![Latest Stable Version](https://poser.pugx.org/rmanara/News-API-php/v/stable)](https://packagist.org/packages/rmanara/News-API-php) -[![License](https://poser.pugx.org/rmanara/News-API-php/license)](https://packagist.org/packages/rmanara/News-API-php) -[![Latest Unstable Version](https://poser.pugx.org/rmanara/News-API-php/v/unstable)](https://packagist.org/packages/rmanara/News-API-php) +# News API SDK for PHP +[![PHP Composer](https://github.com/rodrigomanara/News-API-php/actions/workflows/php.yml/badge.svg)](https://github.com/rodrigomanara/News-API-php/actions/workflows/php.yml) +[![Latest Stable Version](https://poser.pugx.org/rmanara/news-api-php/v/stable)](https://packagist.org/packages/rmanara/news-api-php) +[![License](https://poser.pugx.org/rmanara/news-api-php/license)](https://packagist.org/packages/rmanara/news-api-php) +A lightweight PHP SDK for the [NewsAPI v2](https://newsapi.org/docs/) service. +Search through millions of articles from over 30,000 news sources and blogs — including breaking news and niche publications. -# News API SDK for PHP +--- -Search through millions of articles from over 30,000 large and small news sources and blogs. This includes breaking news as well as lesser articles. -find out more about it: [documentation](https://newsapi.org/docs/) +## Requirements -# Example +| Requirement | Version | +|---|---| +| PHP | `>= 7.4` | +| ext-curl | any | +| ext-json | any | + +--- + +## Installation + +```bash +composer require rmanara/news-api-php:^1.0 +``` + +--- + +## Quick start + +```php +require_once __DIR__ . '/vendor/autoload.php'; + +$api = new \NewsApi\Api('YOUR_API_KEY', ['q' => 'PHP', 'language' => 'en']); +$data = $api->getData(); + +// $data is a stdClass decoded from the JSON response. +echo $data->totalResults; +foreach ($data->articles as $article) { + echo $article->title . PHP_EOL; +} +``` + +> **Security note:** the API key is transmitted via the `X-Api-Key` request header +> and is never appended to the URL. This keeps it out of server access logs, +> browser history, and HTTP Referer headers. + +--- + +## Constructor + +```php +new \NewsApi\Api( + string $apiKey, // Required. Key from newsapi.org. + array $query = [], // Endpoint query parameters. + string $type = enumType::TOP_HEADLINE // Endpoint type constant. +) ``` -require_once __DIR__ . '/../vendor/autoload.php'; -$api = new \NewsApi\Api( array('q' => 'Reino Unido' , 'language'=> 'pt' , 'apiKey' => newsapi)); +Validation runs before any network request is made, in this order: + +1. `$apiKey` must be non-empty. +2. `$type` must be one of the `enumType` constants. +3. `$query` must contain at least one parameter. + +If any check fails, `getData()` returns a local error array and no HTTP call is made. + +--- + +## Endpoints + +Use the `\NewsApi\enumType` constants to select an endpoint: + +| Constant | Endpoint | Required query params | +|---|---|---| +| `enumType::TOP_HEADLINE` *(default)* | `top-headlines` | one of: `sources`, `q`, `language`, `country` | +| `enumType::EVERYTHING` | `everything` | one of: `q`, `sources`, `domains` | +| `enumType::SOURCES` | `sources` | none — all params optional | + +--- + +## Examples + +### Top headlines + +```php +$api = new \NewsApi\Api('YOUR_API_KEY', ['country' => 'gb']); +$data = $api->getData(); +``` + +### Search everything + +```php +use NewsApi\Api; +use NewsApi\enumType; + +$api = new Api('YOUR_API_KEY', ['q' => 'climate change', 'language' => 'en'], enumType::EVERYTHING); +$data = $api->getData(); +``` + +### Discover sources + +```php +use NewsApi\Api; +use NewsApi\enumType; + +$api = new Api('YOUR_API_KEY', ['language' => 'en', 'country' => 'us'], enumType::SOURCES); +$sources = $api->getData(); +``` + +--- + +## Error handling + +### Local validation errors + +When a validation guard fails before any request is made, `getData()` returns an +associative array: + +```php +// Missing or empty API key +$api = new \NewsApi\Api('', ['q' => 'test']); +$data = $api->getData(); +// ['error' => ['apikey' => 'missing apikey']] + +// Unsupported endpoint type +$api = new \NewsApi\Api('YOUR_API_KEY', ['q' => 'test'], 'bad-type'); +$data = $api->getData(); +// ['error' => ['type' => 'type is not correct']] + +// Empty query array +$api = new \NewsApi\Api('YOUR_API_KEY', []); +$data = $api->getData(); +// ['error' => ['query' => 'empty query']] +``` + +### Transport errors + +A `\RuntimeException` is thrown when cURL fails (e.g. DNS resolution error, +connection timeout): + +```php +try { + $api = new \NewsApi\Api('YOUR_API_KEY', ['q' => 'PHP']); + $data = $api->getData(); +} catch (\RuntimeException $e) { + // Handle transport failure + echo $e->getMessage(); +} +``` + +--- + +## Running the tests -$api->getData(); +```bash +composer test ``` -# Composer install +--- -> composer require rmanara/news-api-php:^1.0 +## License +MIT © [Rodrigo Manara](https://github.com/rodrigomanara) diff --git a/composer.lock b/composer.lock index c3942e6..340a5a2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2409f98df9a558b4ac750e927a0b5a0f", + "content-hash": "e3fcbb06c7bbf2bfafbed3782ed24591", "packages": [], "packages-dev": [ { @@ -1488,10 +1488,10 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": [], - "prefer-stable": false, + "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.1", + "php": ">=7.4", "ext-curl": "*", "ext-json": "*" }, From 56d9e81feac43b350a1ac17624f36f8a3a0ad73a Mon Sep 17 00:00:00 2001 From: codediesel Date: Thu, 2 Apr 2026 22:11:58 +0000 Subject: [PATCH 28/29] correct agents --- src/AbstractApi.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/AbstractApi.php b/src/AbstractApi.php index 6d066f2..b2dc99d 100644 --- a/src/AbstractApi.php +++ b/src/AbstractApi.php @@ -60,6 +60,8 @@ protected function call(string $url, string $apiKey = ''): void throw new \RuntimeException('Failed to initialise a cURL handle.'); } + $dynamicAgent = $_SERVER['HTTP_USER_AGENT'] ?? 'Mozilla/5.0 (Default-Fallback)'; + curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -75,6 +77,7 @@ protected function call(string $url, string $apiKey = ''): void 'Cache-Control: no-cache', // Header-based auth keeps the key out of URLs, logs, and history. 'X-Api-Key: ' . $apiKey, + 'User-Agent : '.$dynamicAgent, ], ]); From 70ec668d859ee41a36bd1ae9d4b591dbde0b1715 Mon Sep 17 00:00:00 2001 From: codediesel Date: Thu, 2 Apr 2026 22:19:31 +0000 Subject: [PATCH 29/29] bug on call agent setting --- demo.php | 3 --- src/AbstractApi.php | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/demo.php b/demo.php index 476c43a..66766f2 100644 --- a/demo.php +++ b/demo.php @@ -16,6 +16,3 @@ // The key is sent via the X-Api-Key header and never appears in the URL. $api = new \NewsApi\Api('YOUR_API_KEY', ['q' => 'Reino Unido', 'language' => 'pt']); $data = $api->getData(); - - -var_dump($data); \ No newline at end of file diff --git a/src/AbstractApi.php b/src/AbstractApi.php index b2dc99d..f1d83f2 100644 --- a/src/AbstractApi.php +++ b/src/AbstractApi.php @@ -70,15 +70,13 @@ protected function call(string $url, string $apiKey = ''): void CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - // Explicitly enforce SSL certificate verification to prevent MITM attacks. CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_HTTPHEADER => [ 'Cache-Control: no-cache', - // Header-based auth keeps the key out of URLs, logs, and history. 'X-Api-Key: ' . $apiKey, - 'User-Agent : '.$dynamicAgent, ], + CURLOPT_USERAGENT => $dynamicAgent, ]); $response = curl_exec($curl);