1. Go to this page and download the library: Download ongom/hot-lib 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/ */
ongom / hot-lib example snippets
Hot\Hot::session('key', 'value');
Hot\Hot::session('active_user', ['user_id'=>2]);
// will set active_user to the session variable
Hot\Hot::session('active_user');
// will get active_user from the session variable
Hot\Hot::deleteSession('active_user');
// will delete session key called active_user from the session variable
Hot\Hot::deleteSession();
// unsets the session.
Hot\Hot::flash('seccess', 'sent the messege successfully');
// will set flash messege with key success
Hot\Hot::flash('success');
// will get flash messege with key sucsess
Hot\Hot::randomString(5);
Hot\Hot::randomLetters(5);
Hot\Hot::randomNumber(5);
Hot\Data::env(); //returns array;
Hot\Data::env('passcode'); //returns the value of the key;
public static function redirect(
string $url,
string|array|null $query = null,
int $status = 302
): never
//usage
Hot\Url::redirect('/login', ['name'=>'tom'], 300)
Hot\Url::redirect('https://www.youtube.com');
public static function redirectBack(
string|array|null $query = null,
int $status = 302
):never
//usage
Hot\Url::redirectBack(['name'=>'tom'], 300)
public static function serverBase(string|array|null $query = null): string
//usage
Hot\Url::serverBase()
//https://ongom.com
public static function incoming(string|array|null $query = null): string
//usage
Hot\Url::incoming()
//https://ongom.com/home
public static function incomingBase(string|array|null $query = null): string
//usage
Hot\Url::incomingBase()
public static function incomingPath(string|array|null $query = null): string
//usage
Hot\Url::incomingPath()
public static function body(bool $as_array = true):array|object|null
Hot\Request::body()
public static function params(bool $as_array = true):array|object|null
Hot\Request::params()
public static function post(bool $as_array = true):array|object|null
Hot\Request::post()
public static function get(bool $as_array = true):array|object|null
Hot\Request::get()
public static function files()
Hot\Request::files()
public static function json($data, int $status_code = 200)
Hot\Response::json()
public static function send($data, int $status_code = 200)
Hot\Response::send()
public static function upload($files, array $options)
$options = [
'allowed_extension'=>['jpg','png'], //(optional)
'min_size'=>3, //optionsl in kb (optional)
'max_size'=>6, //optional in kb (optional)
'upload_path'=>'path/to/upload/directory', //(optional)
'new_name'=>'mode_term_2' //optional
'fixed_name'='any unique upload filename' //optional
];
Hot\Files::upload($_FILES['files'], $options);
// min size = 5 and max size = 20