2017 © Pedro Peláez
 

library hashids

A Hashids bridge for Laravel

image

vinkla/hashids

A Hashids bridge for Laravel

  • Tuesday, May 22, 2018
  • by vinkla
  • Repository
  • 31 Watchers
  • 1027 Stars
  • 707,692 Installations
  • PHP
  • 28 Dependents
  • 1 Suggesters
  • 94 Forks
  • 0 Open issues
  • 17 Versions
  • 10 % Grown

The README.md

hashids, (*1)

Laravel Hashids

A Hashids bridge for Laravel., (*2)

// Encode integers.
Hashids::encode(4815162342);

// Decode strings.
Hashids::decode('1LLb3b4ck');

// Dependency injection example.
$hashidsManager->encode(911);

Build Status Monthly Downloads Latest Version, (*3)

Installation

Require this package, with Composer, in the root directory of your project., (*4)

composer require vinkla/hashids

Configuration

Laravel Hashids requires connection configuration. To get started, you'll need to publish all vendor assets:, (*5)

php artisan vendor:publish

This will create a config/hashids.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases., (*6)

Default Connection Name

This option default is where you may specify which of the connections below you wish to use as your default connection for all work. Of course, you may use many connections at once using the manager class. The default value for this setting is main., (*7)

Hashids Connections

This option connections is where each of the connections are setup for your application. Example configuration has been included, but you may add as many connections as you would like., (*8)

Usage

Here you can see an example of you may use this package. Out of the box, the default adapter is main. After you enter your authentication details in the config file, it will just work:, (*9)

// You can alias this in config/app.php.
use Vinkla\Hashids\Facades\Hashids;

// We're done here - how easy was that, it just works!
Hashids::encode(4815162342);

// This example is simple and there are far more methods available.
Hashids::decode('doyouthinkthatsairyourebreathingnow');

The manager will behave like it is a Hashids\Hashids class. If you want to call specific connections, you can do that with the connection method:, (*10)

use Vinkla\Hashids\Facades\Hashids;

// Writing this...
Hashids::connection('main')->encode($id);

// ...is identical to writing this
Hashids::encode($id);

// and is also identical to writing this.
Hashids::connection()->encode($id);

// This is because the main connection is configured to be the default.
Hashids::getDefaultConnection(); // This will return main.

// We can change the default connection.
Hashids::setDefaultConnection('alternative'); // The default is now alternative.

If you prefer to use dependency injection over facades, then you can inject the manager:, (*11)

use Vinkla\Hashids\HashidsManager;

class Foo
{
    protected $hashids;

    public function __construct(HashidsManager $hashids)
    {
        $this->hashids = $hashids;
    }

    public function bar($id)
    {
        $this->hashids->encode($id);
    }
}

App::make('Foo')->bar();

For more information on how to use the Hashids\Hashids class, check out the docs at hashids/hashids., (*12)

The Versions

22/05 2018

dev-master

9999999-dev

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

12/03 2018

5.0.0

5.0.0.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

11/02 2018

4.0.0

4.0.0.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

01/01 2017

3.1.0

3.1.0.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

15/11 2016

3.0.0

3.0.0.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

11/07 2016

2.4.0

2.4.0.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

05/05 2016

2.3.0

2.3.0.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

30/01 2016

2.2.2

2.2.2.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

17/01 2016

2.2.1

2.2.1.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

14/11 2015

2.2.0

2.2.0.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

07/10 2015

2.1.0

2.1.0.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

06/07 2015

2.0.1

2.0.1.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

30/06 2015

2.0.0

2.0.0.0

A Hashids bridge for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

07/05 2015

1.1.0

1.1.0.0

Laravel 5 wrapper for the Hashids API.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid

05/02 2015

1.0.0

1.0.0.0 https://github.com/vinkla/hashids

Laravel 5 wrapper for the Hashids API.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel encrypt decrypt bitly hash youtube ids hashids obfuscate hashid