2017 © Pedro Peláez
 

library hashids

Laravel package for Hashids

image

torann/hashids

Laravel package for Hashids

  • Tuesday, May 29, 2018
  • by torann
  • Repository
  • 6 Watchers
  • 37 Stars
  • 82,589 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 5 Open issues
  • 5 Versions
  • 10 % Grown

The README.md

Hashids for Laravel

Latest Stable Version Total Downloads, (*1)

This package uses the classes created by hashids.org, (*2)

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


Installation

Composer

From the command line run:, (*4)

$ composer require torann/hashids

Without Package Auto-Discovery, (*5)

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., (*6)

'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:, (*7)

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

A configuration file will be publish to config/hashids.php., (*8)

Usage

Once you've followed all the steps and completed the installation you can use Hashids., (*9)

Encoding

You can simply encode a single id:, (*10)

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

or multiple.., (*11)

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

Decoding

Hashids::decode(Ri7Bi);

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

or multiple.., (*12)

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!, (*13)

The Versions

29/05 2018

dev-master

9999999-dev

Laravel package for Hashids

  Sources   Download

BSD-2-Clause BSD 2-Clause

The Requires

 

laravel hash encode decode hashid

28/01 2016

2.0.1

2.0.1.0

Laravel package for Hashids

  Sources   Download

BSD 2-Clause

The Requires

 

laravel hash encode decode hashid

15/02 2015

2.0.0

2.0.0.0

Laravel package for Hashids

  Sources   Download

BSD 2-Clause

The Requires

 

laravel encrypt decrypt hash hashid

11/09 2014

1.0.0

1.0.0.0

Laravel 4.1 package for Hashids

  Sources   Download

BSD 2-Clause

The Requires

 

laravel encrypt decrypt hash hashid

11/09 2014

0.3.1

0.3.1.0

Laravel 4.1 package for Hashids

  Sources   Download

BSD 2-Clause

The Requires

 

laravel encrypt decrypt hash hashid