Table des matières

1. Internationalization

Languages can be retrieved from

Languages should be copied into the folder /resources/lang.

2. Files

2.1. env

2.1.1. Database

The .env file in the root folder will contains configurations items like the datababase’s credentials.


2.1.2. email


2.1.3. Debugging

The .env file contains a constant called APP_DEBUG. By setting that variable to true, additional errors messages will be displayed.

By putting the application to the production environment, don’t forget to set APP_DEBUG to false.

2.2. htaccess

The .htaccess file of Laravel is located under /public/.htaccess and contains, by default:

<IfModule mod_rewrite.c>
   <IfModule mod_negotiation.c>
      Options -MultiViews -Indexes

   RewriteEngine On

   # Handle Authorization Header
   RewriteCond %{HTTP:Authorization} .
   RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

   # Redirect Trailing Slashes If Not A Folder...
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_URI} (.+)/$
   RewriteRule ^ %1 [L,R=301]

   # Handle Front Controller...
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^ index.php [L]

3. Folders

3.1. public

The only one folder that needs to be accessible to the user through the web. That means that, without exceptions, all the rest (folders app, bootstrap, config, database, ...) shouldn’t be accessible from the web.

The public folder is also the only one with a 755 chmod.

4. Paths

4.1. Override

It’s possible to overwrite default paths like, f.i., the paths for the views.

By default, it’s /resources/views but we can change it by using the method Config::set()

Config::set('view.paths', [base_path().'/my_own_view_path']);

4.2. Set our own

We can create our one paths like one for images, documentations, ...

To respect the Laravel’s framework, we just need to add a file in the /config folder, f.i. adding /config/images.php.

return ['path' => 'uploads'];

The content is really straightforward: the return is an associative array (key->value).

When added, we can immediately use it:

echo config('images.path');