How to use artisan to make views in laravel 5.1

There is very easy way to create a view(blade) file with php artisan make:view {view-name} command using Laravel More Command Package.

First Install Laravel More Command

composer require theanik/laravel-more-command --dev

Then Run

php artisan make:view {view-name}

For example

It create index.blade.php in resource/views directory

php artisan make:view index

It create index.blade.php in resource/views/user directory

php artisan make:view user/index

Thank you.


At the time of writing, there isn't a way to create views via artisan without writing your own command or using a third party package. You could write your own as already suggested or use sven/artisan-view.


Laravel officially doesn't have any Artisan cammands for views.

But you could add third party plugins like Artisan View Here's the link Artisan View

After adding this plugin to your project by the guide provided here you should be able to perform following cammands :

  • Create a view 'index.blade.php' in the default directory

    $ php artisan make:view index
    
  • Create a view 'index.blade.php' in a subdirectory ('pages')

    $ php artisan make:view pages.index
    
  • Create a view with a different file extension ('index.html')

    $ php artisan make:view index --extension=html
    

if you are using laravel 5.1 or 5.2 this gist can help you make:view command just create command copy and paste the code from gist.

Step 1:

php artisan make:command MakeViewCommand

Step 2:

copy class from this gist

https://gist.github.com/umefarooq/ebc617dbf88260db1448