PHP code example of miladimos / laravel-filemanager

1. Go to this page and download the library: Download miladimos/laravel-filemanager 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/ */

    

miladimos / laravel-filemanager example snippets


// in providers
Miladimos\FileManager\Providers\FileManagerServiceProvider::class,

// in aliases
Miladimos\FileManager\Facades\FileManagerFacade::class,

config/filemanager.php;

php artisan storage:link
 
'ftp' => [
    'driver' => 'ftp',
    'host' => 'ftp.example.com',
    'username' => 'your-username',
    'password' => 'your-password',

    // Optional FTP Settings...
    // 'port' => 21,
    // 'root' => '',
    // 'passive' => true,
    // 'ssl' => true,
    // 'timeout' => 30,
],
 
'sftp' => [
    'driver' => 'sftp',
    'host' => 'example.com',
    'username' => 'your-username',
    'password' => 'your-password',

    // Settings for SSH key based authentication...
    'privateKey' => '/path/to/privateKey',
    'password' => 'encryption-password',

    // Optional SFTP Settings...
    // 'port' => 22,
    // 'root' => '',
    // 'timeout' => 30,
],
)

[comment]: <> (public function store&#40;Request $request&#41;)

[comment]: <> ({   )

[comment]: <> (    // This will upload your file to the default folder of selected in config storage)

[comment]: <> (    UploadService::uploadBase64Image&#40;$request->input&#40;'image'&#41;&#41;;)

[comment]: <> (    // This will upload your file to the given as second parameter path of default storage)

[comment]: <> (    UploadService::uploadFile&#40;$request->input&#40;'image'&#41;, 'path/to/upload'&#41;;)

[comment]: <> (    // This will upload your file to the given storage)

[comment]: <> (    UploadService::uploadFile&#40;$request->input&#40;'image'&#41;, 'path/to/upload', 'storage_name'&#41;;)

[comment]: <> (    // This will also resize image to the given width and height)

[comment]: <> (    UploadService::uploadFile&#40;$request->input&#40;'image'&#41;, 'path/to/upload', 'storage_name'&#41;;)

[comment]: <> (})

[comment]: <> (

use Miladimos\FileManager\Services\DirectoryService;

$service = new DirectoryService();
$service->createDirectory($name); // name of directory for create
$service->deleteDirectory($uuid); // uuid of directory for delete in db and disk
$service->listDirectories($path) // list all directories in given path
$service->listDirectoriesRecursive($path); // list all directories in given path Recursively

use Miladimos\FileManager\Services\FileService;

$service = new FileService(); // or resolve(FileService::class)

use Miladimos\FileManager\Services\FileGroupService;

$service = new FileGroupService();
$service->allFileGroups();
$service->createFileGroup(array $data); //  $data = ['title', 'description']
$service->updateFileGroup(FileGroup $fileGroup, array $data); //  $data = ['title', 'description']
$service->deleteFileGroup(FileGroup $fileGroup);

use Miladimos\FileManager\Services\ImageService;

$service = new ImageService();

use Miladimos\FileManager\Services\UploadService;

$service = new UploadService();
 php
composer 

php artisan filemanager:install
 php
php artisan filemanager:init
 php
php artisan migrate