Piko Framework logo

Piko Framework

A tiny PHP framework that keeps things simple, fast, and flexible

Piko is a lightweight and flexible PHP micro framework that aims to keep it simple. It is designed for developers who want the simplicity of plain PHP with the structure of a modern framework. Its implementation follows the KISS (Keep It Simple, Stupid) principle and focuses on a very small footprint, fast execution, and a straightforward, PSR‑compliant architecture.

With Piko, you start from a minimal core and then add only the features you need via small, focused Composer packages.

Piko is licensed under the LGPL v3.0 license.

Why Piko?

Fast and lightweight

Piko has been implemented with performance in mind. Requests are routed quickly using Piko Router, one of the fastest PHP routers, and the view rendering engine uses PHP as its template engine (this is what PHP was originally made for).

Its code has a small footprint (around 200 kB once installed), which makes it suitable for small servers, containers, and microservices.

When should you use Piko?

Piko is a good fit when you:

For very large, highly integrated enterprise applications, a full‑stack framework such as Symfony or Laravel might be more appropriate. For everything else, Piko offers a lean and efficient alternative.

Build applications that fit your needs

Choose the application style that matches your project:

Enable features via Composer packages

Start with the core, then add exactly what you need:

See Concepts for details about aliases, components, events, behaviors, and middleware.

Installation via Composer

composer require piko/framework

A minimal example

Below is a simple example that shows how to build a small HTTP application using FastApplication:

<?php

use Piko\FastApplication;
use Psr\Http\Message\ServerRequestInterface;

require __DIR__ . '/vendor/autoload.php';

$app = new FastApplication();

// Define a route for the home page
$app->listen('GET', '/', function (ServerRequestInterface $request): string {
    return 'Hello, Piko!';
});

$app->run();

From here, you can add more routes, introduce middlewares, configure components, or move to a modular application structure as your project grows.

Inspiration

The concepts used in Piko are inspired by the Yii 2 framework.


Getting started