16235369cb
Highlights include configurable menus, specials, cart/checkout, taxes, customer accounts with email 2FA, newsletters, analytics, refunds, PDF/CSV exports, Square/Mailgun adapters, and optional MySQL migration. See README.md for setup and production configuration. Verified PHP/JavaScript syntax, responsive layouts, registration, 2FA, checkout, dashboard workflows, settings persistence, and PDF generation. Real Square, Mailgun, and MySQL connections require credentials/server access. Square implementation follows the official Payments API and Refunds API.
31 lines
641 B
PHP
31 lines
641 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace FatBottom\Core;
|
|
|
|
final class Router
|
|
{
|
|
private array $routes = [];
|
|
|
|
public function get(string $path, callable $handler): void
|
|
{
|
|
$this->routes['GET'][$path] = $handler;
|
|
}
|
|
|
|
public function post(string $path, callable $handler): void
|
|
{
|
|
$this->routes['POST'][$path] = $handler;
|
|
}
|
|
|
|
public function dispatch(string $method, string $path): void
|
|
{
|
|
$handler = $this->routes[$method][$path] ?? null;
|
|
if ($handler === null) {
|
|
Http::abort(404, 'The page you requested could not be found.');
|
|
}
|
|
$handler();
|
|
}
|
|
}
|
|
|