How to create your own custom console commands | PyroCMS

When you need to create a console command for your website developed using PyroCMS you could simply follow the Laravel documentation. Create your command running the following artisan command:

php artisan make:command TwitterClearCache

It will generate a new command class in:

app/Console/Commands.

Now simply register your command, for example in your themes service provider like so :

namespace Pixney\ThidrandiTheme;

use Anomaly\Streams\Platform\Addon\AddonServiceProvider;
use App\Console\Commands\TwitterClearCache;

class ThidrandiThemeServiceProvider extends AddonServiceProvider
{
    protected $commands = [
        TwitterClearCache::class
    ];
}

Verify the existence of your command by running the artisan command to list all commands:

php artisan list

If you find the command, you should be able to run it using :

php artisan TwitterClearCache

linkedinfacebook