2017 © Pedro Peláez
 

library pwned-api

PwnedApi is a PHP library to work with the API at https://haveibeenpwned.com/API/v2/

image

mike-jg/pwned-api

PwnedApi is a PHP library to work with the API at https://haveibeenpwned.com/API/v2/

  • Tuesday, February 27, 2018
  • by mike-jg
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Pwned API

This is meant as a simple way to interface with the service at https://haveibeenpwned.com/API/v2/, (*1)

Build Status, (*2)

Installation

$ composer require mike-jg/pwned-api

Basic Usage

The preferred way to interact with the API is to use the Client::searchByRange method, as this protects the value of the source password being searched for. See https://haveibeenpwned.com/API/v2/#SearchingPwnedPasswordsByRange, (*3)

<?php
use PwnedApi\Client;

$client = new Client();

$password = sha1("P@ssw0rd");
$rangeResult = $client->searchByRange($password);

// Boolean: was this password found?
echo $rangeResult->wasFound();
// How many times this password was found in the database
echo $rangeResult->getCount();

Alternatively you can also search by a specific password to see if it was found. See https://haveibeenpwned.com/API/v2/#SearchingPwnedPasswordsByPassword, (*4)

<?php
use PwnedApi\Client;

$client = new Client();

$password = sha1("P@ssw0rd");
$rangeResult = $client->searchByPasswordHash($password);

// Boolean: was this password found?
echo $rangeResult->wasFound();
// How many times this password was found in the database
echo $rangeResult->getCount();

Overriding the HTTP client

To specify a different HTTP client to use, e.g. if you need to inject proxy details., (*5)

<?php
use PwnedApi\Client;

$client = new Client();
$client->setHttpClient(new GuzzleHttp\Client());

The Versions

27/02 2018

dev-master

9999999-dev

PwnedApi is a PHP library to work with the API at https://haveibeenpwned.com/API/v2/

  Sources   Download

The Requires

 

The Development Requires

security password web service

27/02 2018

1.0.0

1.0.0.0

PwnedApi is a PHP library to work with the API at https://haveibeenpwned.com/API/v2/

  Sources   Download

The Requires

 

The Development Requires

security password web service

27/02 2018

1.0.1

1.0.1.0

PwnedApi is a PHP library to work with the API at https://haveibeenpwned.com/API/v2/

  Sources   Download

The Requires

 

The Development Requires

security password web service