List of the artisan commands, developers are still confused even after release of laravel 6 » Decode Web

List of the artisan commands, developers are still confused even after release of laravel 6 » Decode Web

Source: https://decodeweb.in/php/php-frameworks/laravel-framework/list-of-the-laravel-artisan-commands-developers-are-still-confused-even-after-release-of-laravel-6/

Hello friends, long time no see ? hehe, I really apologize for the late post after my last article on multi guard authentication. I was quite busy on multiple projects at work. As we all know Taylor Otwell has released a major version of his masterpiece, Laravel 6 recently. Quite impressive, but even though Laravel has moved to version 6 most of the developers are still confused about some of the artisan commands which are the core of Laravel CLI operations.

php artisan route:clear

This command when fired, will clear your cached routes in web.php and api.php. Next time when laravel is booted it will automatically make a new cached file where routes are defined.

php artisan route:cache

Use this command if you want to explicitly clear the cached routes and make new cached file with updated routes.

php artisan config:clear

Laravel stores all the configuration from App/config directory to a single cached config file at App/bootstrap/cache/config.php.

Whenever you add new config file or change existing config file in App/config directory, laravel will not take latest change by default rather we need to clear the cached config file, php artisan config:clear does the same thing for us.

php artisan config:cache

This command clears the cached config file as mentioned above and recaches the latest configurations into a single file again.

php artisan cache:clear

It will remove all the cache associated with the connection to the database.

php artisan view:clear

In laravel blade files are compiled into normal php files and stored into cache at App/storage/framework/views directory

So if you have made any changes into blade files and they are not reflecting in browser, most probably latest changes might have not been cached hence run this command to clear the view caches.

php artisan view:cache

This command serves the same purpose as above but additionally, it auto caches the latest view / blade file changes.

php artisan optimize

Make use of this command extensively as this command will auto clear and recache all the configuration as well as blade files. Most of the time this command is used on production server after doing all the application configurations like creating database, composer install/update etc.

php artisan serve

This is the most common artisan command we use. Why did I actually mentioned this here then ? Here is the reason. We need to make changes to .env file a lot while in development phase because we set variables in key = value pairs and these variables are accessed by configuration files. For example:

App/config/app.php : 'name' => env('APP_NAME', 'Laravel'),

.env file : APP_NAME=AWESOME_APP

‘name’ variable first attempts to take value from the .env file where the key is APP_NAME and if there is no key as APP_NAME then it will take default values as Laravel.

If we change APP_NAME value in .env file something like APP_NAME=MAGNIFICENT_APP, now ‘name’ variable will still be as AWESOME_APP until we stop the laravel application and re-run using

php artisan serve

Conclusion

In this article we discussed about various caching mechanisms laravel provides though artisan commands like php artisan route:clear, php artisan route:cache, php artisan config:clear, php artisan config:cache, php artisan view:clear etc.

web-development laravel

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Laravel Development Company

Skenix Infotech is a top Laravel Website Development Company with Expert Laravel Developers that provides robust Laravel Development Services at fair costs.

How to Hire Laravel Developers and How Much Does It Cost.

Want to make the most out of the latest Laravel technology? Here is your guide on how to hire the best Laravel developer, and at the right price. 

Hire Web Developer

Looking for an attractive & user-friendly web developer? HourlyDeveloper.io, a leading web, and mobile app development company, offers web developers for hire through flexible engagement models. You can **[Hire Web...

Why Web Development is Important for your Business

With the rapid development in technology, the old ways to do business have changed completely. A lot more advanced and developed ways are ...

Laravel Development Company

SemiDot Infotech is a leading Laravel Development company that offers high quality Laravel development services by expert Laravel developers.