Initial commit: Site Builder with PHP API backend

Visual drag-and-drop website builder using GrapesJS with:
- Multi-page editor with live preview
- File-based asset storage via PHP API (no localStorage base64)
- Template library, Docker support, and Playwright test suite

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 19:25:42 +00:00
commit a71b58c2c7
58 changed files with 14464 additions and 0 deletions

33
router.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
/**
* PHP Built-in Server Router
*
* Usage: php -S localhost:8081 router.php
*
* Routes /api/* requests to api/index.php and serves all other
* requests as static files (same behavior as Apache with .htaccess).
*/
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
// Route API requests to the API handler
if (strpos($uri, '/api/') === 0) {
require __DIR__ . '/api/index.php';
return true;
}
// Serve static files as-is
$filePath = __DIR__ . $uri;
if ($uri !== '/' && is_file($filePath)) {
return false; // Let PHP's built-in server handle the file
}
// Default: serve index.html for directory requests
if (is_dir($filePath)) {
$indexPath = rtrim($filePath, '/') . '/index.html';
if (is_file($indexPath)) {
return false;
}
}
return false;