How to run CakePHP 3.7 Shell Commands in Heroku console

Author - Kailash Kumar

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

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *