Guide

Getting Started

From configuration and the first route to a working page.

Start with configuration, providers, and routes

  • app/Config/Config.yaml defines which modules are loaded.
  • app/Config/Providers.yaml lists application providers.
  • app/Config/Routing.php defines the application HTTP routes.
  • Touch ./framework only 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.

example.php
<?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.

example.php
<?php

use App\Controllers\HomeController;
use Lemonade\Framework\Routing\Router;

return static function (Router $router): void {
    $router->getNamed(
        'home.index',
        '/',
        HomeController::class . '@index',
    );
};