Via Composer
composer require keltron/filehelper
php artisan vendor:publish --tag=filehelper.config
php artisan vendor:publish --provider="Keltron\Filehelper\FilehelperServiceProvider"
php artisan vendor:publish --provider="Keltron\Filehelper\FilehelperServiceProvider" --tag="migrations"
php artisan migrate --path=database/migrations/2021_09_13_055730_create_filehelper_table.php
View Files and folders in the project by going to the following route
files/file_helper_dashboard
Login credentials (username/password) are required to access the files dashboard.
These can be set in the filehelper.php config file.
Default credentials are fh_admin/fh_admin@246
Be sure to change these credentials before deploying the application.
public static function putFile(
$folder,
$file,
$file_name = '',
$file_types = ['image', 'pdf', 'doc'],
$max_file_size = 0
) { }
@param string $folder
The folder to store the file. If the folder does not exist, it will be created.
@param \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file
The file to store. If the file is a string, it will be converted to a file.
@param string $file_name
(optional) The name of the file. If the file name is not provided, the file name will be the original file name.
@param array $file_types
(optional) File types to be accepted. If not provided, image, pdf and doc files will be accepted. Example: ['image', 'pdf']. Default: ['image', 'pdf', 'doc']
@param array $max_file_size
(optional) File size to be accepted. If not provided, max_file_size parameter in filehelper config file will be used.
@return array
The file information.['status' => true|false, 'message' => '', 'file_name' => '', 'file_path' => '', 'file_url' => '']
public static function getFile($encrypted_file_id, $get_type = 0) { }
@param string $encrypted_file_id — The encrypted file id.
@param int $get_type
(optional) If get_type is 0 it will return file response, If get_type is 1 the file is forcefully download. By default get_type is 0
@param string $file_extension
(optional) The file extension. If the file extension is not provided, the file extension will be the original file extension.
@return \Illuminate\Http\Response
public static function getFileFromPath($encrypted_file_path, $get_type = 0) { }
@param string $encrypted_file_path — The encrypted file path.
@param int $get_type
(optional) If get_type is 0 it will return file response, If get_type is 1 the file is forcefully download. By default get_type is 0
@return \Illuminate\Http\Response
public static function getFileTypeImageFromId($encryptedFileId) { }
@param string $encryptedFileId — The encrypted file id.
@return \Illuminate\Http\Response
public static function getFileTypeImageFromPath($encryptedFilePath) { }
@param string $encryptedFilePath — The encrypted file path.
@return \Illuminate\Http\Response
public static function getFileUrl($encrypted_file_path) { }
@param string $encrypted_file_id The encrypted file id.
@return string The file url.
public static function getFileInfo($encrypted_file_id) { }
@param string $encrypted_file_id — The encrypted file id.
@return array — [ 'status' => true/false, ]
public static function getFileBinary($encrypted_file_id) { }
@param mixed $encrypted_file_id
@return string
public static function deleteFile($encrypted_file_id) { }
@param string $encrypted_file_id — The encrypted file id.
@return array — [ 'status' => true/false, ]
put_file($folder, $file, $file_name = '', $file_types = ['image', 'pdf', 'doc'], $max_file_size = 0)
get_file($encrypted_file_id, $get_type = 0)
get_file_from_path($encrypted_file_path, $get_type = 0)
get_file_type_image_from_id($encrypted_file_path)
get_file_type_image_from_path($encrypted_file_path)
get_file_url($encrypted_file_id)
get_file_info($encrypted_file_id)
get_file_binary($encrypted_file_id)
delete_file($encrypted_file_id)
Please see the changelog for more information on what has changed recently.
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email instead of using the issue tracker.
Please see the license file for more information.