Lemonade Framework

A PSR-based PHP framework for web and CLI runtime.

A modular PHP 8.1+ foundation with PSR HTTP, PSR logging, a PSR-11 compatible container, routing, views, database layer, sessions, validation, uploads and CLI commands.

PSR-based runtimeShared bootstrap for web and CLIComponent foundation
bootstrap/app.php
$kernel->handle();
Runtime flow
RequestKernelProvidersRouterControllerResponse
Product showcase

What ships with Lemonade

Core capabilities

Built for PHP applications that need structure, not noise

PSR-based runtime

HTTP messages, middleware, factories, logging, HTTP client integration and the DI container follow PSR contracts where it makes sense.

Shared bootstrap for web and CLI

Web requests and CLI commands share the same configuration, provider model and container, with separate Kernel and CliKernel entrypoints.

Component foundation

Routing, views, database layer, sessions, validation, uploads, security, events, queues and documentation are organized as explicit framework components.

Components

Framework components

Overview of the main built-in parts that provide the foundation for web applications, CMS projects, administration interfaces and integration systems.

Core

Application Core

ApplicationContext, kernels, runtime lifecycle, configuration loading and service provider orchestration.

component.php
$kernel->handle();
Documentation
Core

CLI Runtime

CLI entrypoint, CliKernel lifecycle, command registry, exit codes and cron pattern with a lock.

component.php
vendor/bin/lemonade list
Documentation
Core

Localization

Current locale resolving, translation loading, fallback strategy and runtime language application.

component.php
$title = $helpers->lang('home.hero.title');
Documentation
Core

Dependency Injection Container

Service lifetimes, bindings, aliases, contextual dependency resolution and practical service registration patterns.

component.php
$container->singleton(MyService::class, MyService::class);
Documentation
Core

Registered Services

DI service registration strategy. Provider-specific registrations and practical examples are split into child pages.

component.php
$container->get(Lemonade\Framework\Routing\UrlGenerator::class);
Documentation
HTTP

HTTP Layer

HTTP request/response runtime, middleware pipeline, dispatch handlers and error rendering flow.

component.php
(new KernelFactory())->create($context)->handle();
Documentation
HTTP

Framework API

Application has a framework API layer with health endpoint, OpenAPI specification and simple HTML documentation.

component.php
GET /api/framework/health
Documentation
HTTP

Middleware

Middleware contracts, processing order, request/response flow interception and composition rules.

component.php
$framework->middleware(fn (MiddlewareStack $stack) => $stack->add(App\Http\Middleware\AuthMiddleware::class));
Documentation
Optimization

HTML Minification

HTML response minification middleware behavior, safety guards and integration points.

component.php
$pipeline->pipe(HtmlMinifyMiddleware::class);
Documentation
HTTP

Routing

Router with explicit and convention routes, named URL generation, route groups and middleware stack.

component.php
$router->getNamed('home', '/', 'HomeController@index');
Documentation
Presentation

View Rendering

View engine wiring, shared variables, component integration and rendering workflow.

component.php
$html = $this->view()->render('home.index', ['title' => 'Homepage']);
Documentation
Presentation

UI Components

Reusable presentation blocks registered through explicit service providers and exposed via ComponentRegistry.

component.php
$components = $container->get(ComponentRegistry::class);
Documentation
Persistence

Database Layer

Shared database infrastructure, provider boundaries, schema API and practical base usage.

component.php
use Lemonade\Framework\Database\Database;

$db = $container->get(Database::class);
$rows = $db->select('SELECT * FROM users WHERE active = ?', [1]);
Documentation
State

Session

Session lifecycle, flash messages, handler bindings and integration into the request flow.

component.php
$session->set('user_id', 42);
Documentation
Security

Security

Security primitives, CSRF protection, safe request processing boundaries and authentication notes.

component.php
<?= $helpers->csrfField() ?>
Documentation
Input

Validation

FormValidation overview, schema usage and dedicated rule pages with detailed validation rule descriptions.

component.php
$result = $validator->field('email')->required()->email()->validate($payload);
Documentation
Diagnostics

Debug

Debug component with a dumper service, context capture and CLI/HTML renderer selection.

component.php
dump($payload);
Documentation
SEO

Discovery

Robots.txt and sitemap.xml integration for technical discoverability.

component.php
$router->get("/sitemap.xml", ...);
Documentation
Files

Filesystem

Filesystem service, storage path helpers, file operations and safe writes during runtime.

component.php
$filesystem->write($context->resolveCachePath('example.json'), json_encode($payload, JSON_THROW_ON_ERROR));
$data = json_decode($filesystem->read($context->resolveCachePath('example.json')), true, 512, JSON_THROW_ON_ERROR);
Documentation
Files

Upload

Upload service flow, file validation boundaries, storage strategies and processing examples.

component.php
$image = $this->upload()->uploadImage('avatar', 'avatar');
Documentation
Observability

Observability

Benchmarking, request logging, tracing hooks and operational diagnostics integration.

component.php
$logger->info('Import started');
Documentation
Support

Support Utilities

Helper utilities, shared support abstractions and recommended usage patterns across the application.

component.php
$url = $helpers->url('documentation.show', ['path' => 'core']);
Documentation