PHPackages                             mathsgod/light-server - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mathsgod/light-server

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mathsgod/light-server
=====================

A lightweight PHP 8.1+ file-based routing server inspired by Nuxt.js pages, built on PSR-7/PSR-15 with League Route and Laminas.

v1.2.1(1mo ago)01771MITPHPPHP ^8.1CI passing

Since Mar 18Pushed 3w ago1 watchersCompare

[ Source](https://github.com/mathsgod/light-server)[ Packagist](https://packagist.org/packages/mathsgod/light-server)[ RSS](/packages/mathsgod-light-server/feed)WikiDiscussions main Synced today

READMEChangelog (9)Dependencies (15)Versions (10)Used By (1)

Light Server
============

[](#light-server)

[![Tests](https://github.com/mathsgod/light-server/actions/workflows/tests.yml/badge.svg)](https://github.com/mathsgod/light-server/actions/workflows/tests.yml)

A lightweight PHP 8.1+ web framework with file-based routing, PSR-7 support, and automatic dependency injection.

Requirements
------------

[](#requirements)

- PHP 8.1+

Features
--------

[](#features)

- 📄 **File-system based routing** — drop a file in `pages/`, get a route automatically
- 🔀 **Dynamic routes** — `pages/blog/{id}/index.php` → `/blog/{id}`
- 🛠️ **PSR-7 / PSR-15 standard** — standard HTTP message and middleware interfaces
- 💉 **Automatic dependency injection** — method parameters resolved from a PSR-11 container
- 🎯 **Attribute-based middleware** — attach PSR-15 middleware directly to handler methods via PHP attributes
- 💪 **Global middleware** — pipe middleware at the server level
- 🔒 **Built-in security headers** — optional `SecurityHeadersMiddleware`

Installation
------------

[](#installation)

```
composer require mathsgod/light-server
```

Quick Start
-----------

[](#quick-start)

### 1. Create an entry point

[](#1-create-an-entry-point)

```
