laszlof / php-hibp
A PHP library for communicating with the HaveIBeenPwned.com API
0.1.2
2017-10-06 21:00 UTC
Requires
- php: ^7.0
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- phpunit/phpunit: ^6.4
This package is not auto-updated.
Last update: 2024-04-28 01:45:09 UTC
README
laszlof/php-hibp
is an SDK which allows PHP developers to easily communicate with the API provided by HaveIBeenPwned.Com.
Requirements
- PHP 7.0+
How to install
composer require laszlof/php-hibp
Usage
Get a list of breaches for a specific acccount (username/email)
use Hibp\Hibp; $account = 'you@yourdomain.com'; $breaches = Hibp::getBreaches($account);
Get a single breach by name
use Hibp\Hibp; $name = 'Adobe'; $breach = Hibp::getBreach($account);
Get a list of sites that have been breached (optionally filtered by domain)
use Hibp\Hibp; $breaches = Hibp::getBreachedSites(); $domain = 'adobe.com'; $breaches = Hibp::getBreachedSites($domain);
Get a list of the types of dataclasses
use Hibp\Hibp; $dataClasses = Hibp::getDataClasses();
Get a list of pastes for a specific acccount (username/email)
use Hibp\Hibp; $account = 'you@yourdomain.com'; $breaches = Hibp::getPastes($account);
Check if a password has been compromised.
use Hibp\Hibp; $password = 'password123'; $isCompromised = Hibp::checkPassword($password); // Optionally check with a password that IS a hash itself. $password_is_a_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'; $isCompromised = Hibp::checkPassword($password_is_a_hash, true);