Restructure init.php to modern layout: public/, src/, config/, resources/, storage/; update paths and directories list; keep generation consistent.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This commit is contained in:
Bruno Eckhardt committed 2026-06-22 11:46:19 +02:00
1 parent 56dfb79c02
commit e6f40c7e01
1 file changed
+93 -92
+93 -92
View File
@@ -24,29 +24,29 @@ $baseDir = getcwd() . DIRECTORY_SEPARATOR . $projectName;
$dirs = [
'',
'WEBROOT',
'WEBROOT/api',
'WEBROOT/api/v1',
'public/api',
'public/api/v1',
'WEBROOT/commands',
'WEBROOT/static',
'public/static',
'WEBROOT/src',
'WEBROOT/src/config',
'WEBROOT/src/database',
'WEBROOT/src/utils',
'WEBROOT/src/MVC',
'WEBROOT/src/MVC/Core',
'WEBROOT/src/MVC/Classes',
'WEBROOT/src/MVC/Controller',
'WEBROOT/src/MVC/Model',
'WEBROOT/src/MVC/View',
'WEBROOT/src/MVC/View/admin',
'WEBROOT/src/MVC/View/templates',
'WEBROOT/src/MVC/Middleware',
'WEBROOT/src/MVC/Layout',
'WEBROOT/src/MVC/Layout/Templates',
'WEBROOT/src/MVC/Layout/Block',
'WEBROOT/storage',
'WEBROOT/storage/uploads',
'WEBROOT/logs',
'src/config',
'src/database',
'src/utils',
'src/MVC',
'src/MVC/Core',
'src/MVC/Classes',
'src/MVC/Controller',
'src/MVC/Model',
'src/MVC/View',
'src/MVC/View/admin',
'src/MVC/View/templates',
'src/MVC/Middleware',
'src/MVC/Layout',
'src/MVC/Layout/Templates',
'src/MVC/Layout/Block',
'storage',
'storage/uploads',
'storage/logs',
];
foreach ($dirs as $dir) {
@@ -70,7 +70,7 @@ echo "Drücke STRG+C zum Beenden.\n\n";
passthru("php -S $host:$port -t \"$root\" \"$root/index.php\"");
PHP;
$files['WEBROOT/logs/error.log'] = <<<'LOG'
$files['storage/logs/error.log'] = <<<'LOG'
LOG;
$files['.htaccess'] = <<<'HTACCESS'
@@ -112,7 +112,7 @@ $files[$projectName . '.code-workspace'] = <<<VSCODE
"files.exclude": {
"*.git*": true,
"WEBROOT/config_backups": true,
"WEBROOT/static": true,
"public/static": true,
"WEBROOT/templates": true,
},
"editor.renderWhitespace": "all",
@@ -150,7 +150,7 @@ $files[$projectName . '.code-workspace'] = <<<VSCODE
}
VSCODE;
$files['WEBROOT/src/utils/databaseMethods.php'] = <<<'PHP'
$files['src/utils/databaseMethods.php'] = <<<'PHP'
<?php
function DatabaseCreateTable($table, $columnsDefinition) {
@@ -377,7 +377,7 @@ function DatabaseShowWithFK($table, $fkMap = [], $columns = "*", $where = "", ..
PHP;
// --- CONFIG: env.ini ---
$files['WEBROOT/src/config/env.ini'] = <<<INI
$files['config/env.ini'] = <<<INI
[database]
APP_ENV = "dev"
@@ -405,7 +405,7 @@ BLOCK_PAGE_TEMPLATE = "modern"
INI;
// --- DB: databaseConnect.php ---
$files['WEBROOT/src/database/databaseConnect.php'] = <<<'PHP'
$files['src/database/databaseConnect.php'] = <<<'PHP'
<?php
function db_connect() {
$config = parse_ini_file(__DIR__ . '/../config/env.ini');
@@ -448,7 +448,7 @@ function db_connect_root() {
PHP;
// -- CLASSES --
$files['WEBROOT/src/MVC/Classes/Api.php'] = <<<'PHP'
$files['src/MVC/Classes/Api.php'] = <<<'PHP'
<?php
namespace MVC\Classes;
@@ -468,7 +468,7 @@ class Api {
}
PHP;
$files['WEBROOT/src/MVC/Classes/Client.php'] = <<<'PHP'
$files['src/MVC/Classes/Client.php'] = <<<'PHP'
<?php
namespace MVC\Classes;
@@ -502,7 +502,7 @@ class Client {
}
PHP;
$files['WEBROOT/src/MVC/Classes/Cookie.php'] = <<<'PHP'
$files['src/MVC/Classes/Cookie.php'] = <<<'PHP'
<?php
namespace MVC\Classes;
@@ -525,7 +525,7 @@ class Cookie {
}
PHP;
$files['WEBROOT/src/MVC/Classes/Request.php'] = <<<'PHP'
$files['src/MVC/Classes/Request.php'] = <<<'PHP'
<?php
namespace MVC\Classes;
@@ -561,7 +561,7 @@ class Request {
}
PHP;
$files['WEBROOT/src/MVC/Classes/Logger.php'] = <<<'PHP'
$files['src/MVC/Classes/Logger.php'] = <<<'PHP'
<?php
namespace MVC\Classes;
@@ -606,7 +606,7 @@ class Logger {
}
PHP;
$files['WEBROOT/src/MVC/Classes/Mailer.php'] = <<<'PHP'
$files['src/MVC/Classes/Mailer.php'] = <<<'PHP'
<?php
namespace MVC\Classes;
@@ -750,7 +750,7 @@ class Mailer {
}
PHP;
$files['WEBROOT/src/MVC/Classes/Server.php'] = <<<'PHP'
$files['src/MVC/Classes/Server.php'] = <<<'PHP'
<?php
namespace MVC\Classes;
@@ -778,7 +778,7 @@ class Server {
}
PHP;
$files['WEBROOT/src/MVC/Classes/Auth.php'] = <<<'PHP'
$files['src/MVC/Classes/Auth.php'] = <<<'PHP'
<?php
namespace MVC\Classes;
@@ -863,7 +863,7 @@ class Auth {
}
PHP;
$files['WEBROOT/src/MVC/Classes/Form.php'] = <<<'PHP'
$files['src/MVC/Classes/Form.php'] = <<<'PHP'
<?php
namespace MVC\Classes;
@@ -960,7 +960,7 @@ class Form {
}
PHP;
$files['WEBROOT/src/MVC/Classes/Storage.php'] = <<<'PHP'
$files['src/MVC/Classes/Storage.php'] = <<<'PHP'
<?php
namespace MVC\Classes;
@@ -1060,7 +1060,7 @@ $files[] = [
PHP;
// --- CORE ---
$files['WEBROOT/src/MVC/Core/Controller.php'] = <<<'PHP'
$files['src/MVC/Core/Controller.php'] = <<<'PHP'
<?php
namespace MVC\Core;
@@ -1089,7 +1089,7 @@ class Controller {
PHP;
$files['WEBROOT/src/MVC/Core/Model.php'] = <<<'PHP'
$files['src/MVC/Core/Model.php'] = <<<'PHP'
<?php
namespace MVC\Core;
@@ -1163,7 +1163,7 @@ abstract class Model {
}
PHP;
$files['WEBROOT/src/MVC/Core/View.php'] = <<<'PHP'
$files['src/MVC/Core/View.php'] = <<<'PHP'
<?php
namespace MVC\Core;
@@ -1194,7 +1194,7 @@ class View {
PHP;
$files['WEBROOT/src/MVC/Core/Router.php'] = <<<'PHP'
$files['src/MVC/Core/Router.php'] = <<<'PHP'
<?php
namespace MVC\Core;
@@ -1272,7 +1272,7 @@ class Router {
}
PHP;
$files['WEBROOT/src/MVC/Core/Middleware.php'] = <<<'PHP'
$files['src/MVC/Core/Middleware.php'] = <<<'PHP'
<?php
namespace MVC\Core;
@@ -1308,7 +1308,7 @@ class Middleware {
}
PHP;
$files['WEBROOT/src/MVC/Core/MiddlewareInterface.php'] = <<<'PHP'
$files['src/MVC/Core/MiddlewareInterface.php'] = <<<'PHP'
<?php
namespace MVC\Core;
@@ -1321,7 +1321,7 @@ interface MiddlewareInterface {
}
PHP;
$files['WEBROOT/src/MVC/Middleware/AdminMiddleware.php'] = <<<'PHP'
$files['src/MVC/Middleware/AdminMiddleware.php'] = <<<'PHP'
<?php
namespace MVC\Middleware;
@@ -1338,7 +1338,7 @@ class AdminMiddleware implements MiddlewareInterface {
}
PHP;
$files['WEBROOT/src/MVC/Middleware/AuthMiddleware.php'] = <<<'PHP'
$files['src/MVC/Middleware/AuthMiddleware.php'] = <<<'PHP'
<?php
namespace MVC\Middleware;
@@ -1355,7 +1355,7 @@ class AuthMiddleware implements MiddlewareInterface {
}
PHP;
$files['WEBROOT/src/MVC/Middleware/BlockMiddleware.php'] = <<<'PHP'
$files['src/MVC/Middleware/BlockMiddleware.php'] = <<<'PHP'
<?php
namespace MVC\Middleware;
@@ -1393,7 +1393,7 @@ class BlockMiddleware implements MiddlewareInterface {
}
PHP;
$files['WEBROOT/src/MVC/Middleware/EveryRequestMiddleware.php'] = <<<'PHP'
$files['src/MVC/Middleware/EveryRequestMiddleware.php'] = <<<'PHP'
<?php
namespace MVC\Middleware;
@@ -1424,7 +1424,7 @@ class EveryRequestMiddleware implements MiddlewareInterface {
}
PHP;
$files['WEBROOT/src/MVC/Layout/Layout.php'] = <<<'PHP'
$files['src/MVC/Layout/Layout.php'] = <<<'PHP'
<?php
namespace MVC\Layout;
class Layout {
@@ -1459,7 +1459,7 @@ class Layout {
}
PHP;
$files['WEBROOT/src/MVC/autoloader.php'] = <<<'PHP'
$files['src/MVC/autoloader.php'] = <<<'PHP'
<?php
spl_autoload_register(function ($class) {
@@ -1482,7 +1482,7 @@ spl_autoload_register(function ($class) {
PHP;
// --- LAYOUT TEMPLATE ---
$files['WEBROOT/src/MVC/Layout/Templates/main.php'] = <<<'HTML'
$files['src/MVC/Layout/Templates/main.php'] = <<<'HTML'
<!DOCTYPE html>
<html lang="de" class="<?= ($_SESSION['theme'] ?? 'light') === 'dark' ? 'dark-mode' : '' ?>">
@@ -1626,7 +1626,7 @@ $files['WEBROOT/src/MVC/Layout/Templates/main.php'] = <<<'HTML'
HTML;
// --- CONTROLLERS ---
$files['WEBROOT/src/MVC/Controller/AdminController.php'] = <<<'PHP'
$files['src/MVC/Controller/AdminController.php'] = <<<'PHP'
<?php
namespace MVC\Controller;
use MVC\Core\Controller;
@@ -1658,7 +1658,7 @@ class AdminController extends Controller {
}
PHP;
$files['WEBROOT/src/MVC/View/admin/mail.php'] = <<<'HTML'
$files['src/MVC/View/admin/mail.php'] = <<<'HTML'
<h2>📧 E-Mail Service</h2>
<?php if (isset($message)): ?> <div
@@ -1692,7 +1692,7 @@ $files['WEBROOT/src/MVC/View/admin/mail.php'] = <<<'HTML'
</div>
HTML;
$files['WEBROOT/src/MVC/View/admin/users.php'] = <<<'HTML'
$files['src/MVC/View/admin/users.php'] = <<<'HTML'
<h2>👤 Benutzerverwaltung</h2>
<?php if (isset($message)): ?>
<div
@@ -1716,7 +1716,7 @@ $files['WEBROOT/src/MVC/View/admin/users.php'] = <<<'HTML'
</form>
HTML;
$files['WEBROOT/src/MVC/Controller/ApiController.php'] = <<<'PHP'
$files['src/MVC/Controller/ApiController.php'] = <<<'PHP'
<?php
namespace MVC\Controller;
@@ -1733,7 +1733,7 @@ class ApiController extends Controller {
}
PHP;
$files['WEBROOT/src/MVC/Controller/HomeController.php'] = <<<'PHP'
$files['src/MVC/Controller/HomeController.php'] = <<<'PHP'
<?php
namespace MVC\Controller;
use MVC\Core\Controller;
@@ -1759,7 +1759,7 @@ class HomeController extends Controller {
}
PHP;
$files['WEBROOT/src/MVC/Controller/AuthController.php'] = <<<'PHP'
$files['src/MVC/Controller/AuthController.php'] = <<<'PHP'
<?php
namespace MVC\Controller;
@@ -1804,7 +1804,7 @@ class AuthController extends Controller {
}
PHP;
$files['WEBROOT/src/MVC/Controller/DocsController.php'] = <<<'PHP'
$files['src/MVC/Controller/DocsController.php'] = <<<'PHP'
<?php
namespace MVC\Controller;
@@ -1820,7 +1820,7 @@ class DocsController extends Controller {
}
PHP;
$files['WEBROOT/src/MVC/Controller/TestController.php'] = <<<'PHP'
$files['src/MVC/Controller/TestController.php'] = <<<'PHP'
<?php
namespace MVC\Controller;
use MVC\Core\Controller;
@@ -1854,7 +1854,7 @@ class TestController extends Controller {
}
PHP;
$files['WEBROOT/src/MVC/Controller/TemplateController.php'] = <<<'PHP'
$files['src/MVC/Controller/TemplateController.php'] = <<<'PHP'
<?php
namespace MVC\Controller;
@@ -1936,7 +1936,7 @@ class TemplateController extends Controller {
PHP;
// --- API ---
$files['WEBROOT/api/v1/get.php'] = <<<'PHP'
$files['public/api/v1/get.php'] = <<<'PHP'
<?php
header('Content-Type: application/json');
@@ -1955,12 +1955,12 @@ PHP;
// --- VIEWS ---
$files['WEBROOT/src/MVC/View/home.php'] = "<h1>Dashboard</h1><p>Willkommen in deinem neuen MVC-System mit integriertem Header.</p>";
$files['WEBROOT/src/MVC/View/test1.php'] = "<h1>Service 1</h1><p><?= \$msg ?></p>";
$files['WEBROOT/src/MVC/View/test2.php'] = "<h1>System Check</h1>
$files['src/MVC/View/home.php'] = "<h1>Dashboard</h1><p>Willkommen in deinem neuen MVC-System mit integriertem Header.</p>";
$files['src/MVC/View/test1.php'] = "<h1>Service 1</h1><p><?= \$msg ?></p>";
$files['src/MVC/View/test2.php'] = "<h1>System Check</h1>
<ul><?php foreach(\$data as \$k => \$v): ?><li><b><?= \$k ?>:</b> <?= \$v ?></li><?php endforeach; ?></ul>";
$files['WEBROOT/src/MVC/View/docs.php'] = <<<'HTML'
$files['src/MVC/View/docs.php'] = <<<'HTML'
<div class="docs-container">
<h1>🏛️ MVC Framework - Die Entwickler-Bibel</h1>
@@ -2023,7 +2023,7 @@ $files['WEBROOT/src/MVC/View/docs.php'] = <<<'HTML'
<h2>1.1 Request Lifecycle</h2>
<p>Der Weg einer Anfrage durch das Framework ist linear und vorhersehbar:</p>
<ol>
<li><strong>Entry:</strong> Alle Requests treffen auf <code>WEBROOT/index.php</code>.</li>
<li><strong>Entry:</strong> Alle Requests treffen auf <code>public/index.php</code>.</li>
<li><strong>Bootstrap:</strong> Session wird gestartet, der <code>autoloader</code> lädt Klassen
nach Bedarf.</li>
<li><strong>Routing:</strong> Der <code>Router</code> lädt die <code>routes.php</code> und prüft
@@ -2270,7 +2270,7 @@ $files['WEBROOT/src/MVC/View/docs.php'] = <<<'HTML'
<li><strong>Auto-Catch:</strong> Registriert sich als globaler Exception- und Error-Handler.
</li>
<li><strong>Tracing:</strong> Schreibt vollständige Stacktraces in
<code>WEBROOT/logs/error.log</code>.
<code>storage/logs/error.log</code>.
</li>
<li><strong>Manuell:</strong> <code>Logger::log('Nachricht', 'LEVEL')</code> für eigenes
Logging.</li>
@@ -2303,7 +2303,7 @@ $files['WEBROOT/src/MVC/View/docs.php'] = <<<'HTML'
<p>Standardisierte JSON-Antworten über die <code>Api</code> Klasse:</p>
<pre><code>// In src/MVC/Classes/Api.php
Api::jsonResponse(['data' => '...'], 200);</code></pre>
<p>API-Files befinden sich übersichtlich in <code>WEBROOT/api/v1/</code>.</p>
<p>API-Files befinden sich übersichtlich in <code>public/api/v1/</code>.</p>
</section>
<section id="best-practices">
@@ -2449,7 +2449,7 @@ $files['WEBROOT/src/MVC/View/docs.php'] = <<<'HTML'
HTML;
$files['WEBROOT/src/MVC/View/login.php'] = <<<'HTML'
$files['src/MVC/View/login.php'] = <<<'HTML'
<style>
.login-container { max-width: 400px; margin: 50px auto; padding: 30px; border: 1px solid
var(--border); border-radius: 8px; background: var(--sidebar); box-shadow: 0 4px 15px
@@ -2483,7 +2483,7 @@ $files['WEBROOT/src/MVC/View/login.php'] = <<<'HTML'
</div>
HTML;
$files['WEBROOT/src/MVC/View/templates/data_form.php'] = <<<'HTML'
$files['src/MVC/View/templates/data_form.php'] = <<<'HTML'
<h2>📝 Daten-Formular</h2>
<?php use MVC\Classes\Form; ?>
@@ -2633,7 +2633,7 @@ $files['WEBROOT/src/MVC/View/templates/data_form.php'] = <<<'HTML'
</style>
HTML;
$files['WEBROOT/src/MVC/View/templates/data_table.php'] = <<<'HTML'
$files['src/MVC/View/templates/data_table.php'] = <<<'HTML'
<h2>📊 Datenübersicht</h2>
<div class="toolbar">
@@ -2762,7 +2762,7 @@ $files['WEBROOT/src/MVC/View/templates/data_table.php'] = <<<'HTML'
</style>
HTML;
$files['WEBROOT/src/MVC/View/templates/download.php'] = <<<'HTML'
$files['src/MVC/View/templates/download.php'] = <<<'HTML'
<h2>📥 Datei Downloads
</h2>
@@ -2847,7 +2847,7 @@ $files['WEBROOT/src/MVC/View/templates/download.php'] = <<<'HTML'
</style>
HTML;
$files['WEBROOT/src/MVC/View/templates/upload.php'] = <<<'HTML'
$files['src/MVC/View/templates/upload.php'] = <<<'HTML'
<h2>📤 Datei Upload</h2>
<?php use MVC\Classes\Form; ?>
@@ -2946,7 +2946,7 @@ $files['WEBROOT/src/MVC/View/templates/upload.php'] = <<<'HTML'
</style>
HTML;
$files['WEBROOT/src/MVC/Layout/Block/standard.php'] = <<<'HTML'
$files['src/MVC/Layout/Block/standard.php'] = <<<'HTML'
<!DOCTYPE html>
<html lang="de">
<head>
@@ -2972,7 +2972,7 @@ $files['WEBROOT/src/MVC/Layout/Block/standard.php'] = <<<'HTML'
</html>
HTML;
$files['WEBROOT/src/MVC/Layout/Block/modern.php'] = <<<'HTML'
$files['src/MVC/Layout/Block/modern.php'] = <<<'HTML'
<!DOCTYPE html>
<html lang="de">
<head>
@@ -2999,7 +2999,7 @@ $files['WEBROOT/src/MVC/Layout/Block/modern.php'] = <<<'HTML'
</html>
HTML;
$files['WEBROOT/src/MVC/Layout/Block/minimal.php'] = <<<'HTML'
$files['src/MVC/Layout/Block/minimal.php'] = <<<'HTML'
<!DOCTYPE html>
<html lang="de">
<head>
@@ -3025,7 +3025,7 @@ Time: <?php echo date('r'); ?>
HTML;
// --- CONFIG: routes.php ---
$files['WEBROOT/src/config/routes.php'] = <<<'PHP'
$files['config/routes.php'] = <<<'PHP'
<?php
/**
@@ -3058,7 +3058,7 @@ $router->add('api/v1/become', \MVC\Controller\ApiController::class, 'become');
PHP;
// --- CONFIG: navigation.php ---
$files['WEBROOT/src/config/navigation.php'] = <<<'PHP'
$files['config/navigation.php'] = <<<'PHP'
<?php
/**
* Define your sidebar navigation items here.
@@ -3079,7 +3079,7 @@ return [
PHP;
// --- ENTRY POINT ---
$files['WEBROOT/index.php'] = <<<'PHP'
$files['public/index.php'] = <<<'PHP'
<?php
session_start();
require_once __DIR__ . '/src/MVC/autoloader.php';
@@ -3243,7 +3243,7 @@ function createModel($args) {
// Namen formatieren
$className = str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($tableName))));
$modelFile = __DIR__ . "/WEBROOT/src/MVC/Model/{$className}.php";
$modelFile = __DIR__ . "/src/MVC/Model/{$className}.php";
// Spalten aufbereiten
$columns = array_map('trim', explode(',', $columnsInput));
@@ -3282,7 +3282,7 @@ PHPMODEL;
if (!file_exists($modelFile)) {
file_put_contents($modelFile, $content);
echo "✅ Model erstellt: WEBROOT/src/MVC/Model/{$className}.php\n";
echo "✅ Model erstellt: src/MVC/Model/{$className}.php\n";
echo "--- INFO ---\n";
echo "Tabelle: {$tableName}\n";
echo "Klasse: MVC\\Model\\{$className}\n";
@@ -3335,10 +3335,10 @@ function createModule($args) {
$className = str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
$label = $label ?: ucwords(str_replace('_', ' ', $key));
$controllerFile = __DIR__ . "/WEBROOT/src/MVC/Controller/{$className}Controller.php";
$viewFile = __DIR__ . "/WEBROOT/src/MVC/View/{$key}.php";
$routesFile = __DIR__ . "/WEBROOT/src/config/routes.php";
$navFile = __DIR__ . "/WEBROOT/src/config/navigation.php";
$controllerFile = __DIR__ . "/src/MVC/Controller/{$className}Controller.php";
$viewFile = __DIR__ . "/src/MVC/View/{$key}.php";
$routesFile = __DIR__ . "/config/routes.php";
$navFile = __DIR__ . "/config/navigation.php";
// 1. Controller erstellen
if ($doController) {
@@ -3369,7 +3369,7 @@ PHPCTRL;
if (!file_exists($controllerFile)) {
file_put_contents($controllerFile, $controllerContent);
echo "✅ Controller erstellt: WEBROOT/src/MVC/Controller/{$className}Controller.php\n";
echo "✅ Controller erstellt: src/MVC/Controller/{$className}Controller.php\n";
} else {
echo "⚠️ Controller existiert bereits.\n";
}
@@ -3396,7 +3396,7 @@ HTML;
if (!file_exists($viewFile)) {
file_put_contents($viewFile, $viewContent);
echo "✅ View erstellt: WEBROOT/src/MVC/View/{$key}.php\n";
echo "✅ View erstellt: src/MVC/View/{$key}.php\n";
} else {
echo "⚠️ View existiert bereits.\n";
}
@@ -3450,10 +3450,10 @@ PHP;
$files['install_db.php'] = <<<'PHP'
<?php
if (php_sapi_name() !== 'cli') die("CLI only.\n");
require_once __DIR__ . '/WEBROOT/src/database/databaseConnect.php';
require_once __DIR__ . '/WEBROOT/src/utils/databaseMethods.php';
require_once __DIR__ . '/src/database/databaseConnect.php';
require_once __DIR__ . '/src/utils/databaseMethods.php';
$config = parse_ini_file(__DIR__ . '/WEBROOT/src/config/env.ini');
$config = parse_ini_file(__DIR__ . '/config/env.ini');
$env = strtoupper($config['APP_ENV']);
$dbName = $config["DB_{$env}_DATABASE"];
$workerUser = $config["DB_{$env}_USERNAME"];
@@ -3497,7 +3497,7 @@ foreach ($tables as $name => $info) {
echo "--- $name ---\n";
try {
if (DatabaseCreateTable($name, $info['columns'])) {
$path = __DIR__ . "/WEBROOT/src/MVC/Model/{$name}.php";
$path = __DIR__ . "/src/MVC/Model/{$name}.php";
if (!file_exists($path)) {
if (!is_dir(dirname($path))) mkdir(dirname($path), 0755, true);
file_put_contents($path, $info['model']);
@@ -3511,8 +3511,8 @@ foreach ($tables as $name => $info) {
// 3. Test-User anlegen
echo "👤 Erstelle Test-User...\n";
require_once __DIR__ . '/WEBROOT/src/MVC/Core/Model.php';
require_once __DIR__ . '/WEBROOT/src/MVC/Model/Users.php';
require_once __DIR__ . '/src/MVC/Core/Model.php';
require_once __DIR__ . '/src/MVC/Model/Users.php';
try {
if (!\MVC\Model\Users::getByUsername('admin')) {
\MVC\Model\Users::insert([
@@ -3546,9 +3546,10 @@ foreach ($files as $file => $content) {
}
echo "\n✨ Projekt '$projectName' wurde initialisiert!\n";
echo "1. Richte deine Datenbankverbindung in WEBROOT/src/config/env.ini ein.\n";
echo "1. Richte deine Datenbankverbindung in config/env.ini ein.\n";
echo "2. Datenbank installieren: php install_db.php\n";
echo " (Ohne Tabelle werden Logs in /logs/ gespeichert)\n";
echo "3. CLI-Tool nutzen: php make.php help\n";
echo "4. Starten: php server.php\n";
echo "5. Öffnen: http://localhost:8000\n";