Chapter 2 of 15

Installation and first application.

Install the package, prepare one HTTP entry point, and run your first request.

Requirements and installation

Use PHP 8.3, 8.4, or 8.5 with Composer and the fileinfo, mbstring, and xmlwriter extensions. Database, image, or HTTP modules may also require PDO, GD, or cURL.

Terminal
composer require johnnyxlemonade/framework
php -S 127.0.0.1:8000 -t public

The Composer command adds the package to an existing application. Use PHP’s built-in server locally once public/index.php is in place.

HTTP entry point

Point the web server document root at public/. The entry point creates an application context from the project root, builds the kernel, and hands it the current request.

public/index.php
<?php

declare(strict_types=1);

use Lemonade\Framework\Core\Context\ApplicationContextFactory;
use Lemonade\Framework\Core\KernelFactory;

require dirname(__DIR__) . '/vendor/autoload.php';

$context = (new ApplicationContextFactory())->fromGlobals(dirname(__DIR__));
$kernel = (new KernelFactory())->create($context);
$kernel->handle();

Configuration, providers, and routes are loaded during bootstrap, so the entry point stays deliberately small.

Detailed technical documentation on GitHub