sagnikrivud / php-folderaspire
Create dynamic folder at storage or any location
Requires
- php: ^8.0
- backpack/crud: ^6.0.0
- backpack/filemanager: ^3.0
- symfony/console: ^4.0||^5.0||^6.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is not auto-updated.
Last update: 2025-04-01 09:30:04 UTC
README
Automating folder generation in PHP can be done using the mkdir() function, which is used to create directories. Here's a brief example of how you can automatically generate folders:
- Custom PHP
- Wordpress
- Laravel (10.0 or Higher)
Versions and compatibility
- Php 8.0 or higher is required
- Apache 2
- Composer 2.0
Status
Under Development
Installation
Please follow this steps, and also refer the code blocks for ths setup using php dependency manager (composer). Open terminal and run this command, but this is need to remember that the user file or folder write permission should be given under same group, like user: sudo and group: www-data
in composer.json under require you can directly write "sagnikrivud/php-folderaspire" under require and run:
$ composer install
OR
You can directly run from terminal
$ composer require sagnikrivud/php-folderaspire
Use the Service Provider class at PHP file after auto loading configuration:
require __DIR__ . '/vendor/autoload.php';
use Sagnikd\FolderAspire\Classes\Folder;
$manageFolder = new Folder();
create a folder with permission
$manageFolder->createDirectory('path/to/directory_name', 775); //Return true/false
Import directory from an existing parent directory
$manageFolder->importDirectory('source/dir','destination/dir');
Get proper location or Path of a Folder or File
$manageFolder->getFolderLocation('folderName/fileName'); //Return "/FolderAspire/Config/Label.php"
Get a Namespace of Class or Service provider
$manageFolder->recoverNamespace(null,'path/to/class_file'); //Return "App\Http\Controllers"
Lock a directory
$manageFolder->lockDirectory('folder', 'path/to/folder'); //Return true/false
Remove folder or File
$manageFolder->removeFileOrDirectory('patha/to/file_or_direcory_name'); // Return true/false
Base/root directory
'Base' => env('BASE_ROOT', __DIR__),