xsist10/haveibeenpwned
Composer 安装命令:
composer require xsist10/haveibeenpwned
包简介
Client for the "Have I Been Pwned" API
README 文档
README
Install
{
"require": {
"xsist10/haveibeenpwned": "~1.0"
}
}
Usage
Create manager instance
use xsist10\HaveIBeenPwned\HaveIBeenPwned; use xsist10\HaveIBeenPwned\Adapter\Curl; use xsist10\HaveIBeenPwned\Adapter\FileGetContents; // By default the $manager will use a Curl adapter $manager = new HaveIBeenPwned(); // You can create a new manager with a specified adapter $manager = new HaveIBeenPwned(new Curl()); // You can also set the adapter after creation $manager->setAdapter(new FileGetContents());
Check if you've been pwned
$manager->checkAccount("your_email_address");
Check if your account has been leaked in a paste
$manager->getPasteAccount("your_email_address");
Check if your password has been leaked before
// Your password is not sent to the remote API. Only a partial of the SHA1 // value is sent and all matching full SHA1 results are returned and compared. $numberOfTimesCompromised = $manager->isPasswordCompromised("your_password");
List all breaches that have are on record
$manager->getBreaches(); $manager->getBreach('specific_breach_by_name');
List the types of data that are covered when describing a leak
$manager->getDataClasses();
Logger Support
The adapters support PSR-3 Logger. I recommend using monolog.
Install Monolog
$ composer require monolog/monolog
Use Monolog with HaveIBeenPwned
use xsist10\HaveIBeenPwned\HaveIBeenPwned; use xsist10\HaveIBeenPwned\Adapter\Curl; use Monolog\Logger; use Monolog\Handler\StreamHandler; $log = new Logger('name'); // Push all logging up to the level of DEBUG to our log file $log->pushHandler(new StreamHandler('[full log filename]', Logger::DEBUG)); $adapter = new Curl(); $adapter->setLogger($log); $manager = new HaveIBeenPwned($adapter); // Calls made to HaveIBeenPwned will be logged to your log file now
Credits
- Troy Hunt for creating https://haveibeenpwned.com/
- Thomas Shone
- Chung-Sheng, Li
License
The MIT License (MIT). Please see License File for more information.
xsist10/haveibeenpwned 适用场景与选型建议
xsist10/haveibeenpwned 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20.86k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2014 年 06 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 xsist10/haveibeenpwned 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 xsist10/haveibeenpwned 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20.86k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 15
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-06-21