Learn how to run CakePHP 3.7 Shell Commands in Heroku console
1. Create myCommandShell.php file in src/Shell folder with below content
<?php namespace App\Shell; use Cake\Console\Shell; use App\Controller\PagesController; class myCommandShell extends Shell { public function main() { // do your work here echo “In myCommandShell”; $pageController = new PagesController (); // calling pages controller index function $pageController->index (); exit; } }
2. Deploy your changes
3. Log in to your Heroku account
4. Run console from Heroku
5. Run shell command
Leave A Comment