Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 640 Bytes

README.md

File metadata and controls

29 lines (23 loc) · 640 Bytes

cakephp-hashids

Hashids Component for CakePHP 2.x

Usage

First, get Hashids.php from http://www.hashids.org/php/ and put it in your app's Vendor/Hashids folder.

Then, add this to your AppController.php:

public $components = array (
	// ...
	'Hashids' => array (
		'salt' => 'YOUR_SALT_HERE', // Required
		'min_hash_length' => 0, // Optional
		'alphabet' => '', // Optional
	)
);

And use on your Controllers like this:

$this->Hashids->encrypt(1, 2, 3);

Or in your Components, Views or anywhere else:

HashidsComponent::encrypt(1, 2, 3);