flatline/authy-laravel
AuthyLaravel
This is a really simple laravel package that wraps Authy_Api.
Installation
-
Install the
flatline/authy-laravelpackage$ composer require "flatline/authy-laravel:dev-master" -
Update
app/config/app.phpto activate Authy# Add `AuthyLaravelServiceProvider` to the `providers` array 'providers' => array( ... 'Flatline\AuthyLaravel\AuthyLaravelServiceProvider', ) # Add the `Authy` facade to the `aliases` array 'aliases' => array( ... 'Authy' => 'Flatline\AuthyLaravel\Facades\Authy', )
The facade is not required, as you can request the Authy_Api class through the container with any variation of the following:
$authy = app('authy');
// or:
$authy = App::make('Authy_Api');
// or even:
class Foo
{
protected $authy;
public function __construct(\Authy_Api $authy)
{
$this->authy = $authy;
}
}
In all of the cases, the calss will be automatically initialized with your corresponding API key and url (production or sandbox) before injection.
Configuration
-
Generate a template Authy config file
$ php artisan config:publish flatline/authy-laravel -
Update
app/config/packages/flatline/authy-laravel/config.phpwith your Authy API keys and turn on or off sandbox mode:return [ /* |-------------------------------------------------------------------------- | Sandbox Mode |-------------------------------------------------------------------------- | | While you're developing your application you might want to work on the | sandbox environment. To do so, just set this variable to "true". | */ 'sandbox' => false, /* |-------------------------------------------------------------------------- | API Keys |-------------------------------------------------------------------------- | | First, you'll need to create your application on the Authy Dashboard. | Once you created your Authy App, copy the API keys and paste them here. | */ 'api_key' => 'your-api-key', 'sandbox_api_key' => 'your-sandbox-api-key', ];
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.