2017 © Pedro Peláez
 

library hashify

Quickly create a (database unique) string.

image

jorenvanhocht/hashify

Quickly create a (database unique) string.

  • Wednesday, February 1, 2017
  • by jorenvh
  • Repository
  • 1 Watchers
  • 0 Stars
  • 317 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 27 % Grown

The README.md

Hashify

This Laravel package makes it easy to generate random strings from a given charset. It can also generate database table and/or column unique strings., (*1)

Installation

This package can be installed through Composer., (*2)

composer require jorenvanhocht/hashify

You must register the service provider., (*3)

// config/app.php
'provider' => [
    ...
    jorenvanhocht\Hashify\Providers\HashifyServiceProvider::class,
    ...
];

This package also comes with a facade, which provides an easy way to call the class., (*4)

// config/app.php
'aliases' => [
    ...
    'Hashify'    => jorenvanhocht\Hashify\Facades\Hashify::class,
    ...
];

You can publish the config file of this package with this command:, (*5)

php artisan vendor:publish --provider="jorenvanhocht\Hashify\HashifyServiceProvider"

The following config file will be published in config/hashify.php, (*6)

<?php

return [
    'charsets' => [
        'database' => 'ABCDEFGHIJKLMNOPQRSTUVWabcdefghijklmnopqrstuvw0123456789',
    ],
];

Usage

private $hashify;
public function __construct(Hashify $hashify)
{
    $this->hashify = $hashify;
}

public function myMethod()
{
    // random string
    echo $this->hashify->make($minLength, $maxLength);

    // database unique random string
    echo $this->hashify->make()->unqique('users');
    echo $this->hashify->make()->unqique('users', 'colName');
    echo $this->hashify->make(2, 10)->unqique('users', 'colName');
}

To do

The usage of different char sets., (*7)

License

The MIT License (MIT). Please see License File for more information., (*8)

The Versions

01/02 2017

dev-master

9999999-dev

Quickly create a (database unique) string.

  Sources   Download

MIT

The Requires

 

01/02 2017

v3.0

3.0.0.0

Quickly create a (database unique) string.

  Sources   Download

MIT

The Requires

 

06/06 2016

v2.1

2.1.0.0

Quickly create a (database unique) string.

  Sources   Download

MIT

The Requires

 

03/06 2016

v2.0

2.0.0.0

Quickly create a (database unique) string.

  Sources   Download

MIT

The Requires

 

25/03 2016

v1.0

1.0.0.0

Quickly create a (database unique) hash.

  Sources   Download

MIT

The Requires