1. Go to this page and download the library: Download peterujah/php-functions 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/ */
peterujah / php-functions example snippets
use \Peterujah\NanoBlock\Functions;
$func = new Functions();
class MyFunction extends \Peterujah\NanoBlock\Functions{
public function __construct(){
}
public function myFunction(){
//do anything
}
public static function myStaticFunction(){
//do anything
}
}
Functions::download(
"path/to/download/file.zip", //string filepath to download
"file.zip", // string file name to download
false // bool delete file after download is complete true or false
);
Functions::truncate(
$text, //string text to truncate
$length // int length to display
);
Functions::base64_url_encode($input);
Functions::base64_url_decode($encoded_input);
Functions::maskEmail(
$email, // string email address
"*" // character to mask with
);
Functions::mask(
$string, // string to mask
"#", // character to mask with
$position //string position to mask left|right|center"
)
Functions::remove(
"path/to/delete/file/", // path to delete files
false // delete base file once sub files and folders has been deleted
)
Functions::writeLog(
"path/to/logs/", // string path to save logs
"info.php", // string log file name, use .php extension to secure log file from accessible in browser
$data, // mixed log content
$secure, // bool set true if file is using .php extension security method
$serialize, // bool serialize log content
$replace // bool replace old log content
);
Functions::saveLog(
"path/to/logs/", // string path to save logs
"info.php", // string log file name, use .php extension to secure log file from accessible in browser
$data, // mixed log content
$secure, // bool set true if file is using .php extension security method
$serialize, // bool serialize log content
);
Functions::findLog(
"path/to/logs/info.php", //string filepath to log
$unserialize // bool unserialize content if it was saved in serialize mode
);
$func->stripeText(
$string, // string text to stripe unwanted characters
$rules, // array rules array("[br/]" => " ","<script>" => "oops!",)
$textarea // bool display text inside textarea
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.