-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from DragonBe/psr-compat
Psr compat
- Loading branch information
Showing
11 changed files
with
452 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,11 @@ | |
"type": "library", | ||
"require": { | ||
"php": ">= 7.2", | ||
"guzzlehttp/guzzle": "^6.3" | ||
"guzzlehttp/guzzle": "^6.3", | ||
"psr/http-message": "^1.0", | ||
"psr/http-client": "^1.0", | ||
"ricardofiorani/guzzle-psr18-adapter": "^1.0", | ||
"psr/http-factory": "^1.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
|
@@ -28,5 +32,17 @@ | |
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "stable" | ||
"minimum-stability": "stable", | ||
"scripts": { | ||
"check": [ | ||
"@cs-check", | ||
"@test", | ||
"@infection" | ||
], | ||
"cs-check": "phpcs", | ||
"cs-fix": "phpcbf", | ||
"test": "phpunit --colors=always", | ||
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml", | ||
"infection": "infection --only-covered" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Hibp; | ||
|
||
use Dragonbe\Hibp\Hibp; | ||
use Dragonbe\Hibp\HibpFactory; | ||
use GuzzleHttp\Psr7\Request; | ||
use GuzzleHttp\Psr7\Response; | ||
use Psr\Http\Client\ClientInterface; | ||
use Psr\Http\Message\RequestInterface; | ||
use Psr\Http\Message\ResponseInterface; | ||
use RicardoFiorani\GuzzlePsr18Adapter\Client; | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
/* | ||
* This example shows the usage of a PSR18 compliant | ||
* HTTP class to make a call to the Have I been pwned | ||
* API service. | ||
* | ||
* @see https://www.php-fig.org/psr/psr-18/ | ||
*/ | ||
/** | ||
* @var ClientInterface | ||
*/ | ||
$client = new Client(HibpFactory::createConfig()); | ||
|
||
/** | ||
* @var RequestInterface | ||
*/ | ||
$request = new Request('GET', '/'); | ||
|
||
/** | ||
* @var ResponseInterface | ||
*/ | ||
$response = new Response(); | ||
|
||
/** | ||
* @var Hibp | ||
*/ | ||
$hibp = new Hibp($client, $request, $response); | ||
|
||
echo 'Password "password": ' . ($hibp->isPwnedPassword('password') ? 'Pwned' : 'OK') . PHP_EOL; | ||
echo 'Password "NVt3MpvQ": ' . ($hibp->isPwnedPassword('NVt3MpvQ') ? 'Pwned' : 'OK') . PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
<?php | ||
|
||
namespace Hibp; | ||
|
||
use Dragonbe\Hibp\Hibp; | ||
use Dragonbe\Hibp\HibpFactory; | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
$hibp = \Dragonbe\Hibp\HibpFactory::create(); | ||
/* | ||
* This example shows how to quickly get started | ||
* to make a call to the Have I been pwned API service. | ||
*/ | ||
|
||
/** | ||
* @var Hibp | ||
*/ | ||
$hibp = HibpFactory::create(); | ||
|
||
echo 'Password "password": ' . ($hibp->isPwnedPassword('password') ? 'Pwned' : 'OK') . PHP_EOL; | ||
echo 'Password "NVt3MpvQ": ' . ($hibp->isPwnedPassword('NVt3MpvQ') ? 'Pwned' : 'OK') . PHP_EOL; | ||
|
Oops, something went wrong.