PHPackages                             unirend/php-static-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. unirend/php-static-server

ActiveLibrary

unirend/php-static-server
=========================

PHP companion to StaticWebServer — deploy Unirend SSG output on shared hosting with clean URLs, proper 404/500 status codes, range requests, and custom routes.

v0.0.2(1w ago)00MITPHPPHP ^8.1

Since Mar 14Pushed 1w agoCompare

[ Source](https://github.com/keverw/unirend-php)[ Packagist](https://packagist.org/packages/unirend/php-static-server)[ RSS](/packages/unirend-php-static-server/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

unirend/php-static-server
=========================

[](#unirendphp-static-server)

[![Packagist Version](https://camo.githubusercontent.com/10f3558d87e1b43b433a7a0e9ce44080c43647f7877abbff28b8d53bab694142/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f756e6972656e642f7068702d7374617469632d736572766572)](https://packagist.org/packages/unirend/php-static-server)[![Packagist Downloads](https://camo.githubusercontent.com/eb75e1e22cbc0ee2e9ba0671e6b73f5d10710034377846e9b27471425a838ead/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f756e6972656e642f7068702d7374617469632d736572766572)](https://packagist.org/packages/unirend/php-static-server)

**Current version:** `0.0.2`

Serve [Unirend](https://github.com/keverw/unirend) SSG output on shared hosting (cPanel, Apache). Mirrors `StaticWebServer` from the Node.js package — reads the same `page-map.json` format, serves clean URLs, handles 404/500 error pages with correct status codes, range requests, and custom API routes.

- [Requirements](#requirements)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Options](#options)
    - [`singleAssets`](#singleassets)
    - [`assetFolders`](#assetfolders)
- [Error Pages](#error-pages)
- [Error Logging](#error-logging)
    - [Default Behavior (logErrors: true)](#default-behavior-logerrors-true)
    - [Custom Error Hook (onError)](#custom-error-hook-onerror)
    - [Disabling Error Logging](#disabling-error-logging)
    - [PHP Error Log Location](#php-error-log-location)
- [Custom Routes](#custom-routes)
    - [Route Path Normalization](#route-path-normalization)
    - [Request body parsing](#request-body-parsing)
- [Range Requests](#range-requests)
- [`.htaccess`](#htaccess)
- [Local Development](#local-development)
- [Versioning](#versioning)
- [Contributing to unirend-php](#contributing-to-unirend-php)
    - [Running tests](#running-tests)
    - [Running the demo locally](#running-the-demo-locally)
    - [Publishing a new version](#publishing-a-new-version)
- [License](#license)

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

[](#requirements)

- PHP 8.1+
- Apache with `mod_rewrite` (standard on cPanel/shared hosting)

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

[](#installation)

```
composer require unirend/php-static-server
```

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

[](#quick-start)

1. Build your Unirend SSG project — this produces a `build/client/` directory with `page-map.json` inside.
2. Copy the templates into your hosting document root:

```
cp vendor/unirend/php-static-server/templates/index.php .
cp vendor/unirend/php-static-server/templates/.htaccess .
```

3. Edit `index.php` to point at your build directory:

```
