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:
mwpn
2025-10-11 07:08:23 +07:00
commit 0b42271bfe
90 changed files with 8315 additions and 0 deletions

126
app/Core/Controller.php Normal file
View File

@@ -0,0 +1,126 @@
<?php
namespace App\Core;
/**
* NovaCore Base Controller
* All controllers should extend this class
*/
abstract class Controller
{
protected Request $request;
protected Response $response;
protected View $view;
protected Security $security;
public function __construct()
{
$this->request = app('request');
$this->response = app('response');
$this->view = app('view');
$this->security = app('security');
}
/**
* Get request instance
*/
protected function request(): Request
{
return $this->request;
}
/**
* Get response instance
*/
protected function response(): Response
{
return $this->response;
}
/**
* Get underlying view engine instance
*/
protected function viewEngine(): View
{
return $this->view;
}
/**
* Get security instance
*/
protected function security(): Security
{
return $this->security;
}
/**
* Render a view
*/
protected function view(string $view, array $data = []): string
{
return $this->view->render($view, $data);
}
/**
* Return JSON response
*/
protected function json(array $data, int $status = 200): Response
{
return $this->response->json($data, $status);
}
/**
* Redirect to URL
*/
protected function redirect(string $url, int $status = 302): void
{
$this->response->redirect($url, $status);
}
/**
* Return error response
*/
protected function error(string $message, int $status = 400): Response
{
return $this->response->json(['error' => $message], $status);
}
/**
* Return success response
*/
protected function success(array $data = [], string $message = 'Success'): Response
{
return $this->response->json([
'success' => true,
'message' => $message,
'data' => $data
]);
}
/**
* Validate request data
*/
protected function validate(array $data, array $rules): array
{
$errors = [];
foreach ($rules as $field => $rule) {
$value = $data[$field] ?? null;
if (str_contains($rule, 'required') && empty($value)) {
$errors[$field] = "The {$field} field is required.";
}
if (str_contains($rule, 'email') && !filter_var($value, FILTER_VALIDATE_EMAIL)) {
$errors[$field] = "The {$field} field must be a valid email address.";
}
if (str_contains($rule, 'min:') && strlen($value) < (int)substr($rule, 4)) {
$min = substr($rule, 4);
$errors[$field] = "The {$field} field must be at least {$min} characters.";
}
}
return $errors;
}
}