PSR-based runtime
HTTP messages, middleware, factories, logging, HTTP client integration and the DI container follow PSR contracts where it makes sense.
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.
$kernel->handle();
HTTP messages, middleware, factories, logging, HTTP client integration and the DI container follow PSR contracts where it makes sense.
Web requests and CLI commands share the same configuration, provider model and container, with separate Kernel and CliKernel entrypoints.
Routing, views, database layer, sessions, validation, uploads, security, events, queues and documentation are organized as explicit framework components.
Overview of the main built-in parts that provide the foundation for web applications, CMS projects, administration interfaces and integration systems.
ApplicationContext, kernels, runtime lifecycle, configuration loading and service provider orchestration.
$kernel->handle();
CLI entrypoint, CliKernel lifecycle, command registry, exit codes and cron pattern with a lock.
vendor/bin/lemonade list
Current locale resolving, translation loading, fallback strategy and runtime language application.
$title = $helpers->lang('home.hero.title');
Service lifetimes, bindings, aliases, contextual dependency resolution and practical service registration patterns.
$container->singleton(MyService::class, MyService::class);
DI service registration strategy. Provider-specific registrations and practical examples are split into child pages.
$container->get(Lemonade\Framework\Routing\UrlGenerator::class);
HTTP request/response runtime, middleware pipeline, dispatch handlers and error rendering flow.
(new KernelFactory())->create($context)->handle();
Application has a framework API layer with health endpoint, OpenAPI specification and simple HTML documentation.
GET /api/framework/health
Middleware contracts, processing order, request/response flow interception and composition rules.
$framework->middleware(fn (MiddlewareStack $stack) => $stack->add(App\Http\Middleware\AuthMiddleware::class));
HTML response minification middleware behavior, safety guards and integration points.
$pipeline->pipe(HtmlMinifyMiddleware::class);
Router with explicit and convention routes, named URL generation, route groups and middleware stack.
$router->getNamed('home', '/', 'HomeController@index');
View engine wiring, shared variables, component integration and rendering workflow.
$html = $this->view()->render('home.index', ['title' => 'Homepage']);
Reusable presentation blocks registered through explicit service providers and exposed via ComponentRegistry.
$components = $container->get(ComponentRegistry::class);
Shared database infrastructure, provider boundaries, schema API and practical base usage.
use Lemonade\Framework\Database\Database;
$db = $container->get(Database::class);
$rows = $db->select('SELECT * FROM users WHERE active = ?', [1]);
Session lifecycle, flash messages, handler bindings and integration into the request flow.
$session->set('user_id', 42);
Security primitives, CSRF protection, safe request processing boundaries and authentication notes.
<?= $helpers->csrfField() ?>
FormValidation overview, schema usage and dedicated rule pages with detailed validation rule descriptions.
$result = $validator->field('email')->required()->email()->validate($payload);
Debug component with a dumper service, context capture and CLI/HTML renderer selection.
dump($payload);
Robots.txt and sitemap.xml integration for technical discoverability.
$router->get("/sitemap.xml", ...);
Filesystem service, storage path helpers, file operations and safe writes during runtime.
$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);
Upload service flow, file validation boundaries, storage strategies and processing examples.
$image = $this->upload()->uploadImage('avatar', 'avatar');
Benchmarking, request logging, tracing hooks and operational diagnostics integration.
$logger->info('Import started');
Helper utilities, shared support abstractions and recommended usage patterns across the application.
$url = $helpers->url('documentation.show', ['path' => 'core']);