Commands
Overview
<?php
namespace System\Commands;
class ControllersCommand {
public function create($name) {
$controllerPath = ROOT_PATH . '/application/Controllers/' . ucfirst($name) . 'Controller.php';
// Check if controller already exists
if (file_exists($controllerPath)) {
echo "Controller $name already exists.\n";
return;
}
// Basic controller template
$controllerContent = 'Add structure file here.'
// Write the controller file
file_put_contents($controllerPath, $controllerContent);
echo "Controller $name created at $controllerPath.\n";
}
}How to use?
Last updated
Was this helpful?