2017 © Pedro Peláez
 

library tokenize

Tokenization Interface

image

dennislindsey/tokenize

Tokenization Interface

  • Thursday, November 10, 2016
  • by dennislindsey
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 10 % Grown

The README.md

Tokenization

A convenient PHP package for consuming Tokenization APIs, (*1)

Installation

The fastest way to get up and running is to install via composer, make sure you add the repository to your composer.json file before you require the package:, (*2)

$ composer require dennislindsey/tokenize

Laravel/Lumen

There is a service provider included for integration with the Laravel framework. This provider will publish the proper configuration files to their appropriate locations within the framework., (*3)

Laravel

To register the service provider in a Laravel project, add the following to the providers array in config/app.php:, (*4)

'DennisLindsey\Tokenize\Providers\TokenizationServiceProvider',
Lumen

To register the service provider in a Lumen project, add the following to the providers array in bootstrap/app.php:, (*5)

$app->register('DennisLindsey\Tokenize\Providers\TokenizationServiceProvider');

Now, when you execulte Laravel's vendor:publish Artisan command, the configuration files will be published to config/tokenization.php., (*6)

$ php artisan vendor:publish --provider="DennisLindsey\Tokenize\Providers\TokenizationServiceProvider"

Alternatively, you could simply copy-paste /path/to/your/vendor/directory/dennislindsey/tokenize/config/tokenization.php to config/tokenization.php to achieve the same effect., (*7)

Note: you may need to install basicit/lumen-vendor-publish if your Laravel/Lumen installation does not support the vendor:publish artisan command., (*8)

Usage

Tokenization

Initialize your tokenizer

require __DIR__ . '/vendor/autoload.php';
use DennisLindsey\Tokenize\Repositories\TokenizeRepository as Tokenizer;

$tokenizer = new Tokenizer('TokenEx');

Create a token

$token = $tokenizer->store("This is random data");

Validate a token

$tokenizer->validate($token); // true or false

Get tokenized data

$data = $tokenizer->get($token); // original data sent to the store() method

Delete a token

$tokenizer->delete($token); // true or false

Errors and References

Each action call will return a reference ID that can be used to lookup a call in the provider (TokenEx) dashboard. Unsuccessful calls will also return an error describing the problem. Each can be accessed via:, (*9)

var_dump($tokenizer->getErrors()); // array, empty if no errors
var_dump($tokenizer->getReferenceNumber()); // string

Notes

This library is inspired by the work done by cliffom (https://github.com/cliffom/tokenex-php)., (*10)

License

All code is open source under the terms of the [GNU GPL License](GNU GPL License), (*11)

The Versions

10/11 2016

dev-master

9999999-dev

Tokenization Interface

  Sources   Download

The Requires

 

by Dennis Lindsey

tokenization tokenex

10/11 2016

0.1

0.1.0.0

Tokenization Interface

  Sources   Download

The Requires

 

by Dennis Lindsey

tokenization tokenex