CodefyPHP FrameworkCodefyPHP Framework
  • Home
  • Community
    • Forum
    • Github
    • YouTube
  • News
  • Home
  • Community
    • Forum
    • Github
    • YouTube
  • News
home/Knowledge Base/Qubus/Filesystem
Popular Search:installation, codex, mail

Filesystem

17 views 0

Written by Joshua
August 14, 2024

The filesystem is a wrapper for PHP League’s Flysystem by Frank de Jonge. The filesystem includes adapters for working with a local filesystems, SFTP, and Amazon S3.

Configuration

The filesystem configuration file can be found in at config/filesystem.php. The configuration file is only set up for one local filesystem and Amazon S3.

Disks

Here is a look at the filesystem config showing the path for each disk: local, public, cache, media, sessions, cookies, view, logs, and S3.

<?php

declare(strict_types=1);

use function Codefy\Framework\Helpers\storage_path;
use function Qubus\Config\Helpers\env;

return [
    /*
    |--------------------------------------------------------------------------
    | Filesystem disks. You may add as many filesystem disks as you need.
    |
    | Supported Drivers: "local", "ftp", "sftp", "s3"
    |--------------------------------------------------------------------------
    */
    'disks' => [
        /*
        |--------------------------------------------------------------------------
        | Default local disk.
        |--------------------------------------------------------------------------
        */
        'local' => [
            'root' => storage_path(),
            'visibility' => [
                'file' => [
                    'public'  => (int) 0644,
                    'private' => (int) 0604,
                ],
                'dir'  => [
                    'public'  => (int) 0755,
                    'private' => (int) 7604,
                ],
            ],
        ],

        /*
        |--------------------------------------------------------------------------
        | Public disk.
        |--------------------------------------------------------------------------
        */
        'public' => [
            'root' => storage_path(path: 'app/public'),
            'visibility' => [
                'file' => [
                    'public'  => (int) 0644,
                    'private' => (int) 0604,
                ],
                'dir'  => [
                    'public'  => (int) 0755,
                    'private' => (int) 7604,
                ],
            ],
        ],

        /*
        |--------------------------------------------------------------------------
        | Cache disk.
        |--------------------------------------------------------------------------
        */
        'cache' => [
            'root' => storage_path(path: 'framework/cache'),
            'visibility' => [
                'file' => [
                    'public'  => (int) 0644,
                    'private' => (int) 0604,
                ],
                'dir'  => [
                    'public'  => (int) 0755,
                    'private' => (int) 7604,
                ],
            ],
        ],

        /*
        |--------------------------------------------------------------------------
        | Media disk.
        |--------------------------------------------------------------------------
        */
        'media' => [
            'root' => storage_path(path: 'framework/media'),
            'visibility' => [
                'file' => [
                    'public'  => (int) 0644,
                    'private' => (int) 0604,
                ],
                'dir'  => [
                    'public'  => (int) 0755,
                    'private' => (int) 7604,
                ],
            ],
        ],

        /*
        |--------------------------------------------------------------------------
        | Session disk.
        |--------------------------------------------------------------------------
        */
        'sessions' => [
            'root' => storage_path(path: 'framework/sessions'),
            'visibility' => [
                'file' => [
                    'public'  => (int) 0644,
                    'private' => (int) 0604,
                ],
                'dir'  => [
                    'public'  => (int) 0755,
                    'private' => (int) 7604,
                ],
            ],
        ],

        /*
        |--------------------------------------------------------------------------
        | Session disk.
        |--------------------------------------------------------------------------
        */
        'cookies' => [
            'root' => storage_path(path: 'framework/cookies'),
            'visibility' => [
                'file' => [
                    'public'  => (int) 0644,
                    'private' => (int) 0604,
                ],
                'dir'  => [
                    'public'  => (int) 0755,
                    'private' => (int) 7604,
                ],
            ],
        ],

        /*
        |--------------------------------------------------------------------------
        | View disk.
        |--------------------------------------------------------------------------
        */
        'views' => [
            'root' => storage_path(path: 'framework/views'),
            'visibility' => [
                'file' => [
                    'public'  => (int) 0644,
                    'private' => (int) 0604,
                ],
                'dir'  => [
                    'public'  => (int) 0755,
                    'private' => (int) 7604,
                ],
            ],
        ],

        /*
        |--------------------------------------------------------------------------
        | Log disk.
        |--------------------------------------------------------------------------
        */
        'logs' => [
            'root' => storage_path(path: 'logs'),
            'visibility' => [
                'file' => [
                    'public'  => (int) 0644,
                    'private' => (int) 0604,
                ],
                'dir'  => [
                    'public'  => (int) 0755,
                    'private' => (int) 7604,
                ],
            ],
        ],

        /*
        |--------------------------------------------------------------------------
        | Amazon S3
        |--------------------------------------------------------------------------
        */
        's3' => [
            'driver' => 's3',
            'key' => env(key: 'AWS_ACCESS_KEY_ID'),
            'secret' => env(key: 'AWS_SECRET_ACCESS_KEY'),
            'region' => env(key: 'AWS_DEFAULT_REGION'),
            'bucket' => env(key: 'AWS_BUCKET'),
            'url' => env(key: 'AWS_URL'),
            'endpoint' => env(key: 'AWS_ENDPOINT'),
        ],
    ],
    /*
    |--------------------------------------------------------------------------
    | Config for Local FileSystem.
    |--------------------------------------------------------------------------
    */
    'local' => [
        /*
        |--------------------------------------------------------------------------
        | Set the root directory.
        |--------------------------------------------------------------------------
        */
        'root' => storage_path(),
        /*
        |--------------------------------------------------------------------------
        | Set the visibility for files and directories.
        |--------------------------------------------------------------------------
        */
        'visibility' => [
            'file' => [
                'public'  => (int) 0644,
                'private' => (int) 0604,
            ],
            'dir'  => [
                'public'  => (int) 0755,
                'private' => (int) 7604,
            ],
        ],
    ],
];
Edit on Github

Last Updated on August 14, 2024 by Joshua

Related Articles
  • Mailer
  • Logger
  • Migrations
  • Database
  • Event Dispatcher
  • Routing

Didn't find your answer? Check out the Forum

Leave A Comment Cancel reply

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Migrations

  • Copyright 2025 CodefyPHP.com. All Rights Reserved

Popular Search:installation, codex, mail