Guide
Getting Started
From configuration and the first route to a working page.
Start with configuration, providers, and routes
app/Config/Config.yamldefines which modules are loaded.app/Config/Providers.yamllists application providers.app/Config/Routing.phpdefines the application HTTP routes.- Touch
./frameworkonly when maintaining the framework itself.
Your first controller
Start with Lemonade\Framework\Core\AbstractController. It is the public framework base for ordinary controllers. A simple controller can return html(), json(), or redirect() directly without an application-specific base class.
<?php
declare(strict_types=1);
namespace App\Controllers;
use Lemonade\Framework\Core\AbstractController;
use Psr\Http\Message\ResponseInterface;
final class HomeController extends AbstractController
{
public function index(): ResponseInterface
{
return $this->html('<h1>Hello</h1>');
}
}Your first route
Register a simple named route first. Add localization or route groups only when the application actually needs them.
<?php
use App\Controllers\HomeController;
use Lemonade\Framework\Routing\Router;
return static function (Router $router): void {
$router->getNamed(
'home.index',
'/',
HomeController::class . '@index',
);
};