PHP code example of jorenvanhocht / hashify

1. Go to this page and download the library: Download jorenvanhocht/hashify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jorenvanhocht / hashify example snippets


composer 

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

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

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



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

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');
}
config/hashify.php