All Projects → Torann → laravel-hashids

Torann / laravel-hashids

Licence: BSD-2-Clause license
Laravel package for Hashids

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to laravel-hashids

Hashids.js
A small JavaScript library to generate YouTube-like ids from numbers.
Stars: ✭ 3,525 (+6678.85%)
Mutual labels:  hashids
Optimus
🤖 Id obfuscation based on Knuth's multiplicative hashing method for PHP.
Stars: ✭ 1,084 (+1984.62%)
Mutual labels:  hashids
Pg hashids
Short unique id generator for PostgreSQL, using hashids
Stars: ✭ 164 (+215.38%)
Mutual labels:  hashids
Hashids.net
A small .NET package to generate YouTube-like hashes from one or many numbers. Use hashids when you do not want to expose your database ids to the user.
Stars: ✭ 470 (+803.85%)
Mutual labels:  hashids
Laravel Hashids
Integrate Hashids with Laravel. Automatic model binding and id resolving included!
Stars: ✭ 8 (-84.62%)
Mutual labels:  hashids
Laravel Optimus
Transform your internal id's to obfuscated integers based on Knuth's integer hash. Laravel wrapper for the Optimus Library by Jens Segers with multiple connections support.
Stars: ✭ 119 (+128.85%)
Mutual labels:  hashids
bashids
Pure Bash implementation of the hashid algorithm from http://hashids.org/
Stars: ✭ 38 (-26.92%)
Mutual labels:  hashids
Eloquent Hashids
On-the-fly hashids for Laravel Eloquent models. (🍰 Easy & ⚡ Fast)
Stars: ✭ 196 (+276.92%)
Mutual labels:  hashids
Hashids.phpc
🐘 A php extension for Hashids: generate short unique ids from integers.
Stars: ✭ 43 (-17.31%)
Mutual labels:  hashids
Laravel Fakeid
Automatic model ID obfuscation in routes for Laravel
Stars: ✭ 161 (+209.62%)
Mutual labels:  hashids
Hashids
A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.
Stars: ✭ 4,596 (+8738.46%)
Mutual labels:  hashids
Hashids.rb
A small Ruby gem to generate YouTube-like hashes from one or many numbers. Use hashids when you do not want to expose your database ids to the user.
Stars: ✭ 842 (+1519.23%)
Mutual labels:  hashids
Laravel Hashids
A Hashids bridge for Laravel
Stars: ✭ 1,714 (+3196.15%)
Mutual labels:  hashids
Laravel Hashid
Obfuscate your data by generating reversible, non-sequential, URL-safe identifiers.
Stars: ✭ 354 (+580.77%)
Mutual labels:  hashids
Hashids.github.io
Hashids website
Stars: ✭ 163 (+213.46%)
Mutual labels:  hashids
Django Hashid Field
Django Model Field that uses Hashids to obscure the value
Stars: ✭ 256 (+392.31%)
Mutual labels:  hashids
Acts as hashids
Use Youtube-Like ID in ActiveRecord seamlessly.
Stars: ✭ 76 (+46.15%)
Mutual labels:  hashids
Hashid Rails
Use Hashids (http://hashids.org/ruby/) in your Rails app ActiveRecord models.
Stars: ✭ 225 (+332.69%)
Mutual labels:  hashids
Django Rest Framework Serializer Extensions
Extensions to help DRY up Django Rest Framework serializers
Stars: ✭ 180 (+246.15%)
Mutual labels:  hashids
Laravel Hashslug
Package providing a trait to use Hashids on a model
Stars: ✭ 136 (+161.54%)
Mutual labels:  hashids

Hashids for Laravel

Latest Stable Version Total Downloads

This package uses the classes created by hashids.org

Generate hashes from numbers, like YouTube or Bitly. Use hashids when you do not want to expose your database ids to the user.


Installation

Composer

From the command line run:

$ composer require torann/hashids

Without Package Auto-Discovery

Once Hashids is installed you need to register the service provider and facade with the application. Open up config/app.php and find the providers and aliases keys.

'providers' => [
    Torann\Hashids\HashidsServiceProvider::class,
]

'aliases' => [
    'Hashids' => Torann\Hashids\Facade\Hashids::class,
]

Publish the configurations

Run this on the command line from the root of your project:

$ php artisan vendor:publish --provider="Torann\Hashids\HashidsServiceProvider"

A configuration file will be publish to config/hashids.php.

Usage

Once you've followed all the steps and completed the installation you can use Hashids.

Encoding

You can simply encode a single id:

Hashids::encode(1); // Returns Ri7Bi

or multiple..

Hashids::encode(1, 21, 12, 12, 666); // Returns MMtaUpSGhdA

Decoding

Hashids::decode(Ri7Bi);

// Returns
array (size=1)
0 => int 1

or multiple..

Hashids::decode(MMtaUpSGhdA);

// Returns
array (size=5)
0 => int 1
1 => int 21
2 => int 12
3 => int 12
4 => int 666

All credit for Hashids goes to Ivan Akimov (@ivanakimov), thanks to for making it!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].