jincor / verify-php-client
A PHP library which encapsulates interaction with Jincor Verify service
dev-master
2017-11-30 13:21 UTC
Requires
- php: >=7
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- codeception/codeception: ^2.3
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^2.0
This package is not auto-updated.
Last update: 2024-05-16 18:24:49 UTC
README
This is a client library which encapsulates interaction with Jincor Verify. With its help you can:
- Initiate verification process for methods: email, google_auth.
- Validate code.
- Invalidate code.
Usage
Initialize Verify client
To interact with the HTTP protocol use Guzzle. Headers Accept: application/vnd.jincor+json; version=1
, Content-Type: application/json
, Authorization: Bearer JWT_TOKEN
are mandatory.
$verifyClient = new VerifyClient(new Client([ 'base_uri' => 'verify:3000', 'headers' => [ 'Accept' => 'application/vnd.jincor+json; version=1', 'Content-Type' => 'application/json', 'Authorization' => 'Bearer JWT_TOKEN', ] ]));
Initiate Verification process
$verificationDetails = $verifyClient->initiate( (new EmailVerification()) ->setTemplate('{{{CODE}}}') ->setConsumer('test@test.com') ->setExpiredOn('01:00:00') );
Validate Code
$result = $verifyClient->validate(new EmailValidationData( new Uuid('d6b78279-db85-467e-b965-c938d043ffac'), '123456' )); // true
Invalidate Code
$result = $verifyClient->invalidate(new GoogleAuthInvalidationData( new Uuid('d6b78279-db85-467e-b965-c938d043ffab') )); // true
More details can be received in the tests.
Project setup
- Clone the repo
cd /path/to/repo
docker-compose build
- build development containersdocker-compose up -d
- run containerdocker-compose exec workspace composer install
Local testing
To run all tests just type docker-compose exec workspace ./vendor/bin/codecept run
Credits
License
The MIT License (MIT). Please see License File for more information.