Luminova Framework

PHP Luminova: Configure Application File Access & Permissions

Last updated: 2025-08-22 12:44:06

Control file and directory permissions in your application to ensure proper access levels and prevent unauthorized changes.

The Files Configuration class provides properties to set the default Unix file and directory permissions for creating new files and directories in your application.


  • Class namespace: \App\Config\Files
  • File path: /app/Config/Files.php
  • This class is marked as final and can't be subclassed

Properties

filePermissions

Set Unix file permission, to use while creating a new file in your application.

public static int $filePermissions = 0644;

dirPermissions

Set Unix directory permission, to use while creating a new directory.

public static int $dirPermissions = 0755;

extensions

File extensions based on MIME types, where the key is the MIME type and the value is the extension.

This property allows you to specify more extensive mime types their extensions.

protected static array $extensions = [
    'image/jpeg' => 'jpg',
    'image/png' => 'png',
    // Add more...
];

Usages:

$file = 'path/to/file/text.txt';
echo Files::getExtension(get_mime($file)); // Outputs: txt