The question is pretty clear.
php artisan cache:clear
Is there any work around to clear the cache like above we using in CLI. I am using a famous shared hosting service but as per my plan I don't have control panel access.
Basically I want to clear the views cache.
I saw a question almost same like this, but it doesn't helps me.
Thanks in advance.
There is now a command in Laravel 5.1 for that
This package is for php ^7.0 and ^laravel5.5.
Use this package in cronjob that I have created for this purpose only. I was also facing same situation. https://packagist.org/packages/afrazahmad/clear-cached-data Install it and run:
and it will run the following commands automcatically
Hope it helps.
If you want to run it automatically at specific time then you will have to setup crnjob first. e.g.
In schedule function:
You can do it via router as well, similar to Francesco answer but with less clutter in router config
Then run them via visiting http://myapp.test/artisan/cache-clear etc If you need to add/edit valid Artisan commands just update the $validCommands array.
To clear all cache outside CLI, Do this; This works for me.
While I strongly disagree with the idea of running a laravel app on shared hosting (a bad idea all around), this package would likely solve your problem. It is a package that allows you to run some artisan commands from the web. It's far from perfect, but can work for some usecases.
https://github.com/recca0120/laravel-terminal
You can call an Artisan command outside the CLI.
You can check the official doc here http://laravel.com/docs/5.0/artisan#calling-commands-outside-of-cli
Update
There is no way to delete the view cache. Neither
php artisan cache:clear
does that.If you really want to clear the view cache, I think you have to write your own
artisan
command and call it as I said before, or entirely skip theartisan
path and clear the view cache in some class that you call from a controller or a route.But, my real question is do you really need to clear the view cache? In a project I'm working on now, I have almost 100 cached views and they weight less then 1 Mb, while my
vendor
directory is > 40 Mb. I don't think view cache is a real bottleneck in disk usage and never had a real need to clear it.As for the application cache, it is stored in the
storage/framework/cache
directory, but only if you configured thefile
driver inconfig/cache.php
. You can choose many different drivers, such as Redis or Memcached, to improve performances over a file-based cache.