A convenient PHP package for the TokenEx API
The fastest way to get up and running is to install via composer:
$ composer require cliffom/tokenex
require __DIR__ . '/vendor/autoload.php';
use Cliffom\Tokenex\Tokenizer;
$tokenizer = new Tokenizer($TOKENEX_API_BASE_URL, $TOKENEX_ID, $TOKENEX_API_KEY);
// From a credit card number
$token = $tokenizer->token_from_ccnum(4242424242424242);
// From arbitrary data
$token = $tokenizer->tokenize("This is random data containing 3 numbers less than 10");
$tokenizer->validate_token($token); // true or false
$tokenizer->delete_token($token); // true or false
Each action call will return a reference ID that can be used to lookup a call in the TokenEx dashboard. Unsuccessful calls will also return an error describing the problem. Each can be accessed via:
var_dump($tokenizer->error); // array, empty if no errors
var_dump($tokenizer->reference_number); // string
Use the following docker-compose commands to install dependencies and run the specs:
docker-compose run --rm tokenex composer install
docker-compose up
Bug reports and pull requests are welcome on GitHub at https://github.com/cliffom/tokenex-php.
All code is open source under the terms of the [MIT License](MIT License)