Customizing the Laravel View Path

Customizing the Laravel View Path

In response to our post yesterday about Laravel 5.7 Resources Directory Changes, a reader mentioned that they would prefer to have their application views outside of the resources folder.

I thought I’d write up how you can customize the view path; it’s effortless with Laravel!

Laravel provides an easy configuration for view paths within the config/views.php configuration file. The default value that ships with Laravel as of version 5.6 are as follows:

'paths' => [

Let’s say that you wanted your views in app/views. You could change the configuration value to the following:

'paths' => [

You can even provide multiple paths in this array:

'paths' => [

Most aspects of Laravel are configurable, but I’d suggest that you stick to the conventions when possible. If you like to customize things and organize things a little differently, the sky is the limit, and Laravel gets out of your way!

One caveat I would mention is that artisan commands that generate views might use the resource_path(‘views’) path to create files. If you prefer to move the files, it might be good to scaffold all of the views first and then move everything before configuring a new path. Sticking to conventions does ease the pain of some of these things.

If you have an existing app and you want to change the organization of views, you could use the technique above to configure additional paths and slowly move your files into the new path.

Another good habit to get into when you are deploying an application: be sure to use the php artisan view:cache command to warm up your view cache during deployment.

Happy templating! You can learn more about Laravel views in the documentation.

Filed in: Laravel Tutorials / Blade


Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Software Engineer Lead (PHP)
CivicPlus, LLC
Full-time Senior Web Developer
Detroit, MI
Wayne State University
Senior Software Engineer
Sydney, Australia
Full Stack Engineer
Remote or Medford, Oregon
Empire Medical
Laravel Developer (fulltime - Dutch only)
Qbixx | Webservices
Full Stack or Back-End Developer
Alexandria, VA; Tallahassee, FL; Orlando, FL
Marketing for Change
Senior Quality Assurance Engineer
Bisnow Media