atif123's avatar

Meaning of cache:clear config:clear

php artisan cache:clear php artisan config:clear

0 likes
6 replies
RoboRobok's avatar

cache:clear clears your application cache, no matter how it is configured (files, database etc.). It has nothing to do with configs.

config:clear deletes your cached config files. By default it's /bootstrap/cache/config.php. Laravel tries to read config from that file if it exists. Otherwise it reads your config from /config folder.

atif123's avatar

I didn't get it Can you give me some real world example so that I can try and understood it

RoboRobok's avatar

I'm not sure what is it that you don't understand. I assume you are a Laravel beginner, so the best path for you is to just get through the docs.

1 like
jlrdw's avatar

You know what cache is, right.

If not you can Google that word read the definition then you will understand.

3 likes
atif123's avatar

I know meaning of cache but i want to know practically in laravel. Can you give me some example

jlrdw's avatar
jlrdw
Best Answer
Level 75

config:clear you haven't figured out that configuration is cached.

So what do you think config:clear does.

Okay you make a configuration change for example you now have a new password for your database

Now to ensure that you are using current configuration, okay do you see now.

Just curious, did you try:

php artisan help config:clear

which gives:

Description:
  Remove the configuration cache file

Usage:
  config:clear

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Please or to participate in this conversation.