Skip to main content

Project Configurations

Nothing to say here, The Laravel standard configuration, except we'll make some changes.

Let's see our configuration structure roadmap in list of points:

Mongez Configuration Philosophy#

In simple words, we work in multiple levels of configurations, actually, 4 levels to be more preceise:

  • Inline Configurations (A configuration per certain usage only).
  • Module Configurations (Your overriden configuration for certain module).
  • Project Configurations (In config directory).
  • The Vendor Level (Default Configuration).

The previous list is written in the configuration precedence, which means the inline configuration will override any other configuration that match these configuration.

If none of the first three configuration is present, the vendor (default) configuration will be used instead.

More details in depth can be found in Configuration Philosophy.

Storage Configuration#

As Laravel Symlink allows use to create a symlink to a more safer directories, we'll configure our application accordingly.

config/filesystem.php
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/public'),
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

Make sure to add the symbolic link for public storage path for our storage directory.

In this case all uploaded files will be stored in storage/app/public and your link will be https://sitename.com/public/storage, for example

storage/app/public/my-image.webp can be visited in https://sitename.com/public/storage/my-image.webp path.