1. Go to this page and download the library: Download maksuco/helpers 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/ */
\Helpers::user_agent();
//Returns Array ( [desktop] => 1 [mobile] => [tablet] => [device] => desktop [browser] => Chrome [os] => Macintosh [result] => Macintosh Chrome )
//Returns ['lang'], and ['estimate']=true if is not exact data
\Helpers::botDetected();
//Returns true or false
$img = \Helpers::avatar($user);
OR
{{\Helpers::avatar($user->email)}}
{{\Helpers::firstname($fullname)}}
//Gina Gutierrez returns Gina
//Gi Gutierrez returns Gi Gutierrez
{{\Helpers::initials($fullname)}}
//SEND Sofia Loren
//GET SL
{{\Helpers::text_parse($text,$blank)}}
//SEND: Welcome to http:://apple.com
//RETURNS: Welcome to <a href="http:://apple.com">http:://apple.com</a>
{{\Helpers::getTextBetween($text,$start,$end)}}
If you want to replace the text between two strings use
{{\Helpers::replaceTextBetween($text,$start,$end,$replace)}}
$domain = \Helpers::domain_from_email($email);
//returns the domain from an email if it's not a free service like gmail.com, else it returns false
$domain = \Helpers::domain_from_url($url);
//returns the domain.com from http://www.domain.com/something
\Helpers::domain_from_url($url,true); //subdomain true
//returns the account.domain.com from http://account.domain.com/something
$domain = \Helpers::url_html($url);
//returns the body content of url
$domain = \Helpers::url_html($url,'div');
//returns a string with first div content
$domain = \Helpers::url_html($url,'#home',true);
//returns the section with id="home" and true converts all img src and links href to full urls.
//using id selects the entire section, using elements only selects the content.
if(\Helpers::email_check($email)) {}
//returns if the email is valid: true or false
//Also checks if the domain exist
OR
if(\Helpers::domain_check($email)) {}
//returns the domain from the email and checks if it exist
OR
if(\Helpers::domain_check('maksuco.com')) {}
//Checks if the domain exist
\Helpers::random(4);
//returns 4 letters mix with numbers
\Helpers::random(4,true);
//if you want only numbers
\Helpers::random(4,false);
//if you want only letters
\Helpers::random_name($type);
//returns John
\Helpers::random_quote();
//returns Something special
$slug = \Helpers::slug('Hi how are you? Muy@#$%^&*good');
//RETURNS: hi-how-are-you-muy-good
OR
$slug = \Helpers::slug($name);
$slug = \Helpers::slug_file('Hi how are you? Muy@#$%^&*good.jpg',0);
//hi-how-are-you-muy-good.jpg
OR
$slug = \Helpers::slug_file($file->getClientOriginalName(),5);
//hi-how-are-you-muy-good-hj567.jpg
OR
$slug = \Helpers::slug_file($filename,'great-doc');
//hi-how-are-you-muy-good-great-doc.pdf
$slug = \Helpers::slug_filename('SomeFile.jpg','new-name',0);
//new-name.jpg
OR
$slug = \Helpers::slug_filename($file->getorriginalname(),'new-image',2);
//new-image-9i.ext
OR
$slug = \Helpers::slug_filename($file,'one','great-images');
//one-great-images.png