This project allows to you get a two factor validation for different purposes. Is a way to enforce your security website sending two tokens for differentes channels but they need to match in your bussiness logic.
The channels are email and sms., (*1)
To use this tool is necessary have an account in the providers for SMS and EMAILS. In this package we have available two clients to use that are:, (*2)
Be sure to have your accounts and get your API-KEYS-ID. Otherwise if you can't use this providers, you can extends the package creating a class for each new client that you need., (*3)
Is very simple use this package, with the correct configuration, the only thing you need to do in your app is create an instance of TokenEmailSms::, (*4)
$tokenEmailSms = new TokenEmailSms;
Then is necessary set the variables of our recipients:, (*5)
And the next thing you need to do is only send the tokens to the two channels:, (*6)
Now it depends on your bussiness rules but something common to do is get the two generated tokens and saved in your database to do whatever you need to do, this is the place where you are creative and validate in this point that the tokens works together:, (*7)
If you set this two tokents with an id and status in your database, when the user enter the two tokens you will validated and if not match, something is wrong., (*8)
I wrote this package because i need to found an extra secure way to validate some distracted users. They can lose his phone or may be the password email, but in exceptional cases the same person will find both channels together. It's not extra safe, but it try to be more closer to reality., (*9)
To install this project is necessary do the following steps:, (*10)
1 - Composer update
Run composer update to install the libraries., (*11)
2 - Set the config file.
A file called
token-email-sms-config-example.php is provided. You need to set your own file and called
token-email-sms-config.php and set your own credentiales to get TokenEmailSms works. The file is very well described so the only thing you need to do is change the variables from the arrays 'email' and 'sms'., (*12)
Once you have the installation finish and correct setting you can run the tests with:, (*13)
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
The source code is released under Apache 2 License., (*14)
Check LICENSE file for more information., (*15)