feat: Complete Woles Framework v1.0 with enterprise-grade UI
- Add comprehensive error handling system with custom error pages - Implement professional enterprise-style design with Tailwind CSS - Create modular HMVC architecture with clean separation of concerns - Add security features: CSRF protection, XSS filtering, Argon2ID hashing - Include CLI tools for development workflow - Add error reporting dashboard with system monitoring - Implement responsive design with consistent slate color scheme - Replace all emoji icons with professional SVG icons - Add comprehensive test suite with PHPUnit - Include database migrations and seeders - Add proper exception handling with fallback pages - Implement template engine with custom syntax support - Add helper functions and facades for clean code - Include proper logging and debugging capabilities
This commit is contained in:
164
app/Core/Commands/MakeModuleCommand.php
Normal file
164
app/Core/Commands/MakeModuleCommand.php
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Commands;
|
||||
|
||||
/**
|
||||
* NovaCore Make Module Command
|
||||
* CLI command to create new modules
|
||||
*/
|
||||
class MakeModuleCommand
|
||||
{
|
||||
private string $modulesPath;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->modulesPath = __DIR__ . '/../../Modules';
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the command
|
||||
*/
|
||||
public function execute(string $moduleName): void
|
||||
{
|
||||
if (!$moduleName) {
|
||||
echo "Error: Module name is required\n";
|
||||
echo "Usage: php artisan make:module <ModuleName>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$modulePath = $this->modulesPath . '/' . $moduleName;
|
||||
$viewPath = "{$modulePath}/view";
|
||||
|
||||
// Create directories
|
||||
if (!is_dir($modulePath)) {
|
||||
mkdir($modulePath, 0755, true);
|
||||
}
|
||||
if (!is_dir($viewPath)) {
|
||||
mkdir($viewPath, 0755, true);
|
||||
}
|
||||
|
||||
// Create Controller
|
||||
$this->createController($moduleName, $modulePath);
|
||||
|
||||
// Create Model
|
||||
$this->createModel($moduleName, $modulePath);
|
||||
|
||||
// Create Routes
|
||||
$this->createRoutes($moduleName, $modulePath);
|
||||
|
||||
// Create View
|
||||
$this->createView($moduleName, $viewPath);
|
||||
|
||||
echo "Module '{$moduleName}' created successfully!\n";
|
||||
echo "Controller: {$modulePath}/Controller.php\n";
|
||||
echo "Model: {$modulePath}/Model.php\n";
|
||||
echo "Routes: {$modulePath}/routes.php\n";
|
||||
echo "View: {$viewPath}/index.php\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Create controller file
|
||||
*/
|
||||
private function createController(string $moduleName, string $modulePath): void
|
||||
{
|
||||
$controllerContent = "<?php
|
||||
|
||||
namespace App\\Modules\\{$moduleName};
|
||||
|
||||
use App\\Core\\Controller;
|
||||
|
||||
/**
|
||||
* {$moduleName} Controller
|
||||
*/
|
||||
class Controller extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return \$this->view('{$moduleName}.view.index', [
|
||||
'title' => '{$moduleName} - NovaCore Framework'
|
||||
]);
|
||||
}
|
||||
}";
|
||||
|
||||
file_put_contents("{$modulePath}/Controller.php", $controllerContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create model file
|
||||
*/
|
||||
private function createModel(string $moduleName, string $modulePath): void
|
||||
{
|
||||
$modelContent = "<?php
|
||||
|
||||
namespace App\\Modules\\{$moduleName};
|
||||
|
||||
/**
|
||||
* {$moduleName} Model
|
||||
*/
|
||||
class Model
|
||||
{
|
||||
// Add your model methods here
|
||||
}";
|
||||
|
||||
file_put_contents("{$modulePath}/Model.php", $modelContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create routes file
|
||||
*/
|
||||
private function createRoutes(string $moduleName, string $modulePath): void
|
||||
{
|
||||
$routesContent = "<?php
|
||||
|
||||
/**
|
||||
* {$moduleName} Module Routes
|
||||
*/
|
||||
|
||||
\$router->get('/{$moduleName}', '{$moduleName}\\Controller@index');";
|
||||
|
||||
file_put_contents("{$modulePath}/routes.php", $routesContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create view file
|
||||
*/
|
||||
private function createView(string $moduleName, string $viewPath): void
|
||||
{
|
||||
$viewContent = "<!DOCTYPE html>
|
||||
<html lang=\"en\">
|
||||
<head>
|
||||
<meta charset=\"UTF-8\">
|
||||
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
|
||||
<title>{{ \$title }}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
background: #f8f9fa;
|
||||
margin: 0;
|
||||
padding: 2rem;
|
||||
}
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
background: white;
|
||||
padding: 2rem;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
h1 {
|
||||
color: #667eea;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class=\"container\">
|
||||
<h1>{{ \$title }}</h1>
|
||||
<p>Welcome to the {$moduleName} module!</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
file_put_contents("{$viewPath}/index.php", $viewContent);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user