Skip to content

Function libraries

Coding with ArWeb edited this page Oct 17, 2023 · 1 revision

These are some functions to help you in your project

Functions Description
getHostLink($folderPath) Returns host URL on which the server is running
redirectPage($pageName) Redirect the page
callAPI($apiMethod, $apiUrl, $data, $files, $headers) Calls an API with CURL method -> Default values : $apiMethod = "GET", $apiUrl = "", $data = [], $files = true, $headers = null. Returns a JSON string/object
convertToJSON($params) Pass array as parameters. Returns JSON string
convertToArray($params) Pass JSON as parameters. Returns array
stringEncryptB64($params) Pass actual string as parameters. Returns base64 encrypted string
stringDecryptB64($params) Pass base64 encrypted string as parameters. Returns actual string
encryptDecrypt($action, $string, $secretKey, $secretIV, $encryptMethod, $hashKey) Return hash encrypted string or actual string -> Default values : $action=encrypt, $encryptMethod=AES-256-CBC, $hashKey = 'sha256'. Note: $action can be encrypt or decrypt
fileDetails($file, $fileDetails) Returns the details of file based on user input. $fileDetails should have the following : fileTempName / fileSize / fileName / fileType / width / height / fileExtension / fileEncrypt.
getClientIP() Return IP address of the client machine
removeHTMLEntities($input) Returns string after removing special characters
deleteFile($filePath) Delete the file and returns true(1) or false(0)
emptyDirectory($directoryPath) Empty whole directory and returns true(1) / false(0) / -1
resizeImage($resourceType, $image_width, $image_height, $resizeWidth, $resizeHeight) Resize image
display($value) Print value
getEncryptedFileSize($encryptedFile) Returns the size (in bytes) of encrypted file
fileUpload($fileTmpName, $extension) Upload the file. Returns true(1) or false(0)

How to use :


   use Devker\Vaults\Vaults;

   Vaults::functionName();

Clone this wiki locally