Skip to content

Instantly share code, notes, and snippets.

View fendis0709's full-sized avatar
Converting caffeine into code

Fendi fendis0709

Converting caffeine into code
View GitHub Profile
@fendis0709
fendis0709 / AuthServiceProvider.php
Created November 22, 2021 03:50
Check file private and public keys before generate token
class AuthServiceProvider extends ServiceProvider
{
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
@fendis0709
fendis0709 / cryptographically_secure_random_strings.php
Created October 22, 2018 05:42 — forked from raveren/cryptographically_secure_random_strings.php
Generate cryptographically secure random strings. Based on Kohana's Text::random() method and this answer:http://stackoverflow.com/a/13733588/179104
function random_text( $type = 'alnum', $length = 8 )
{
switch ( $type ) {
case 'alnum':
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'alpha':
$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'hexdec':