Rinvex Authy is a simple wrapper for Authy TOTP API, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.
Usage is pretty easy and straightforward:
$apiKey = 'AuthySecretKey'; $httpClient = new \GuzzleHttp\Client();
Note: make sure to replace
AuthySecretKeywith your secret key from the installation steps.
Create a new Authy app instance and interact with it:
$authyApp = new \Rinvex\Authy\App($httpClient, $apiKey); $appStats = $authyApp->stats(); // Get app stats $appDetails = $authyApp->details(); // Get app details
Create a new Authy user instance and interact with it:
$authyUser = new \Rinvex\Authy\User($httpClient, $apiKey); $user = $authyUser->register('[email protected]', '317-338-9302', '54'); // Register user $userActivity = $authyUser->registerActivity($user->get('user')['id'], 'cookie_login', 'Test Data'); // Register user activity $userStatus = $authyUser->status($user->get('user')['id']); // Get user status $userDeleted = $authyUser->delete($user->get('user')['id']); // Delete user
Create a new Authy token instance and interact with it:
$authyToken = new \Rinvex\Authy\Token($httpClient, $apiKey); $smsTokenSent = $authyToken->send($user->get('user')['id'], 'sms'); // Send SMS token $callTokenStarted = $authyToken->send($user->get('user')['id'], 'call'); // Start automated call $tokenVerified = $authyToken->verify(54321, $user->get('user')['id']); // Verify token
Work Intuitively with Authy responses:
$body = $tokenVerified->body(); // Get all response body $code = $tokenVerified->statusCode(); // Get response status code $succeed = $tokenVerified->succeed(); // Check whether respose is a success $failed = $tokenVerified->failed(); // Check whether respose is a failure $message = $tokenVerified->message(); // Get response message $item = $tokenVerified->get('item'); // Get response body item $errors = $tokenVerified->errors(); // Get response errors
Note: All authy requests return authy response, with a unified interface for your convenience, so you can interact with all responses the same way as above.
Install the package via composer:
composer require rinvex/authy
Done! You can refer to Usage again.
API implementation is 100% backward compatible, but sandbox API has been dropped since it's officially deprecated. Also note that PHP7 is now required.
Refer to the Changelog for a full history of the project.
The following support channels are available at your fingertips:
Thank you for considering contributing to this project! The contribution guide can be found in CONTRIBUTING.md.
Bug reports, feature requests, and pull requests are very welcome.
If you discover a security vulnerability within this project, please send an e-mail to [email protected]. All security vulnerabilities will be promptly addressed.
Rinvex is a software solutions startup, specialized in integrated enterprise solutions for SMEs established in Alexandria, Egypt since June 2016. We believe that our drive The Value, The Reach, and The Impact is what differentiates us and unleash the endless possibilities of our philosophy through the power of software. We like to call it Innovation At The Speed Of Life. That’s how we do our share of advancing humanity.
This software is released under The MIT License (MIT).
(c) 2016-2020 Rinvex LLC, Some rights reserved.