The config is in config/lfm.php.

Routing:

use_package_routes

Use default routes or not. You will need to define routes to all controllers of this package if this is set to false.

Multi-User Mode:

allow_private_folder

Only the owner(each signed-in user) of the private can upload and manage files within. Set to false to turn this feature off.

private_folder_name

Privates folders for each user will be named by this config. Default to user id.

To change the behavior:

  1. run php artisan publish tag="lfm_handler"
  2. rewrite userField function in App\Handler\ConfigHandler class
  3. set value of this config to App\Handler\ConfigHandler::class

allow_shared_folder

shared_folder_name

Flexible way to customize client folders accessibility.

If you want to customize client folders:

  1. run php artisan publish tag="lfm_handler"
  2. rewrite userField function in App\Handler\ConfigHandler class
  3. set value of this config to App\Handler\ConfigHandler::class

All users can upload and manage files within shared folders. Set to false to turn this feature off.

Folder Categories

folder_categories

'folder_categories' => [
    'file'  => [
        'folder_name'  => 'files',
        'startup_view' => 'list',
        'max_size'     => 50000, // size in KB
        'valid_mime'   => [
            'image/jpeg',
            'image/pjpeg',
            'image/png',
            'image/gif',
            'application/pdf',
            'text/plain',
        ],
    ],
    'image' => [
        'folder_name'  => 'photos',
        'startup_view' => 'grid',
        'max_size'     => 50000, // size in KB
        'valid_mime'   => [
            'image/jpeg',
            'image/pjpeg',
            'image/png',
            'image/gif',
        ],
    ],
],

The default config creates two folder categories, file and image, each operates independently. Files uploaded by users will be placed under one of these folder categories, depend on which is configured with your WYSIWYG editor or stand-alone upload button.

Detail options are explained here:

Pagination:

paginator

'paginator' => [
    'perPage' => 30,
],

Upload / Validation:

disk

Disk name of Laravel File System. All files are placed in here. Choose one of the disks section in config/filesystems.php.

temporary_url_duration

Duration of AWS S3 temporary urls, in minutes.

s3_acls_disabled

Enable to support AWS S3 “Bucket owner enforced” (ACL-disabled) buckets.

rename_file

If set to true, the uploaded file will be renamed using uniqid().

alphanumeric_filename

If set to true, non-alphanumeric file name will be replaced with _.

alphanumeric_directory

If set to true, non-alphanumeric folder name will be rejected.

should_validate_size

If set to true, the size of uploading file will be verified.

should_validate_mime

If set to true, the mime type of uploading file will be verified.

over_write_on_duplicate

Define behavior on files with identical name. Setting it to true cause old file replace with new one. Setting it to false show error-file-exist error and abort the upload process.

Image Optimization

optimize_uploaded_images

'optimize_uploaded_images' => [
    'enabled' => false,
    'format' => null,
    'quality' => 85,
    'max_width' => null,
    'max_height' => null,
    'progressive' => true,
    'keep_original_when_larger' => true,
    'mimetypes' => [
        'image/jpeg',
        'image/pjpeg',
        'image/png',
        'image/webp',
        'image/avif',
        'image/bmp',
        'image/tiff',
        'image/jp2',
        'image/heic',
    ],
],

When enabled is true, supported uploaded images are re-encoded after the original upload succeeds.

By default format is null, so the original image format is kept. Set format to an output format such as jpg, png, webp, or avif to convert supported uploads. Converted files use the matching extension, for example photo.jpg becomes photo.webp when format is webp.

Driver-dependent formats such as gif, bmp, tiff, jp2, and heic are also accepted. If the configured GD or Imagick driver cannot encode the selected format, the original upload is kept.

When the GD driver is used, WebP output requires PHP’s imagewebp() function and AVIF output requires PHP’s imageavif() function. If the installed GD extension does not provide the required encoder, the upload is kept unchanged and the reason is logged.

GIF uploads are not included in the default mimetypes list because re-encoding animated GIFs can change animation behavior depending on the driver. Add image/gif explicitly if that trade-off is acceptable for your application.

max_width and max_height can be used to scale large uploads down while keeping the aspect ratio. Set both to null to keep the uploaded dimensions.

quality is used for lossy output formats only: jpg, webp, and avif. The value is clamped to the 0..100 range, and non-numeric values fall back to 85.

progressive only affects JPEG output. Other formats ignore it.

If optimization fails, the original upload is kept. If keep_original_when_larger is enabled, the optimized image only replaces the upload when it is smaller than the original. If conversion would overwrite an existing filename, the original upload is kept.

Example verification scenarios:

  1. Keep JPEG format, resize large uploads, and use a lower quality setting:
'optimize_uploaded_images' => [
    'enabled' => true,
    'format' => null,
    'quality' => 75,
    'max_width' => 1600,
    'max_height' => 1600,
    'progressive' => true,
],

Upload a large .jpg. Expected result: the stored file stays .jpg, dimensions are scaled down to fit within 1600x1600, and the JPEG is re-encoded with quality 75.

  1. Convert screenshots to WebP:
'optimize_uploaded_images' => [
    'enabled' => true,
    'format' => 'webp',
    'quality' => 80,
    'mimetypes' => ['image/png', 'image/jpeg', 'image/pjpeg'],
],

Upload a .png or .jpg. Expected result: the stored file becomes .webp. quality is applied to the WebP output.

  1. Re-encode PNG without format conversion:
'optimize_uploaded_images' => [
    'enabled' => true,
    'format' => 'png',
    'quality' => 30,
],

Upload a .png. Expected result: the stored file stays .png. The quality setting does not change the code path here, because PNG uses the driver default encode options in this implementation.

Thumbnail

should_create_thumbnails

If set to true, thumbnails will be created for faster loading.

thumb_folder_name

Folder name to place thumbnails.

raster_mimetypes

'raster_mimetypes' => [
    'image/jpeg',
    'image/pjpeg',
    'image/png',
],

Create thumbnails automatically only for listed types. See full mime types list.

thumb_img_width

Thumbnail images width (in px).

thumb_img_height

Thumbnail images height (in px).

Create thumbnails automatically only for listed types.

File Extension Information

file_type_array

'file_type_array' => [
    'pdf'  => 'Adobe Acrobat',
    'doc'  => 'Microsoft Word',
    'docx' => 'Microsoft Word',
    'xls'  => 'Microsoft Excel',
    'xlsx' => 'Microsoft Excel',
    'zip'  => 'Archive',
    'gif'  => 'GIF Image',
    'jpg'  => 'JPEG Image',
    'jpeg' => 'JPEG Image',
    'png'  => 'PNG Image',
    'ppt'  => 'Microsoft PowerPoint',
    'pptx' => 'Microsoft PowerPoint',
],

Gives description for listed file extensions.

php.ini override

php_ini_overrides

'php_ini_overrides' => [
    'memory_limit' => '256M',
],

These values override your php.ini settings before uploading files. Set these to false to ingnore and apply your php.ini settings

⚠️ Caveats

The php_ini_overrides are applied on every request the filemanager does and are reset once the script has finished executing. This has one drawback: any ini settings that you might want to change that apply to the request itself will not work.

For example, overriding these settings will not work:

Why this is expected behaviour: upload_max_filesize and post_max_size will get set but uploaded files are already passed to your PHP script before the settings are changed.