Complete Phase 1: MVC, DB migrations, Auth, RBAC, Security, and Views

This commit is contained in:
Hamza-Ayed
2026-06-05 00:56:41 +03:00
parent 7ffbc8bafa
commit bed7624ae9
51 changed files with 3295 additions and 0 deletions

62
cli.php Normal file
View File

@@ -0,0 +1,62 @@
<?php
if (php_sapi_name() !== 'cli') {
die("This script can only be run from the command line.");
}
require __DIR__ . '/vendor/autoload.php';
// Bootstrap Environment configurations
if (file_exists(__DIR__ . '/.env')) {
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
}
use App\Core\Container;
use App\Services\Database\Connection;
use App\Services\Database\MigrationRunner;
use Database\Seeds\DatabaseSeeder;
$container = new Container();
// Singletons configurations
$container->singleton(Connection::class, Connection::class);
$container->singleton(MigrationRunner::class, MigrationRunner::class);
$container->singleton(DatabaseSeeder::class, DatabaseSeeder::class);
$args = $argv;
$command = $args[1] ?? 'help';
switch ($command) {
case 'migrate':
echo "=== Running Migrations ===\n";
try {
$runner = $container->get(MigrationRunner::class);
$runner->migrate();
} catch (\Throwable $e) {
echo "Migration failed: " . $e->getMessage() . "\n";
exit(1);
}
break;
case 'seed':
echo "=== Running Database Seeder ===\n";
try {
$seeder = $container->get(DatabaseSeeder::class);
$seeder->seed();
} catch (\Throwable $e) {
echo "Seeding failed: " . $e->getMessage() . "\n";
exit(1);
}
break;
case 'help':
default:
echo "ScoutIQ CLI Utility\n";
echo "Usage: php cli.php [command]\n\n";
echo "Commands:\n";
echo " migrate Run SQL database migrations\n";
echo " seed Seed the database with default data\n";
echo " help Show this help menu\n";
break;
}