PHPackages                             pionia/pionia-app - 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. [API Development](/categories/api)
4. /
5. pionia/pionia-app

ActiveProject[API Development](/categories/api)

pionia/pionia-app
=================

Pionia application template — Moonlight REST API on PHP 8.5+

v3.0.0(1mo ago)8752MITShellPHP &gt;=8.5

Since May 8Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/PioniaPHP-project/Application)[ Packagist](https://packagist.org/packages/pionia/pionia-app)[ RSS](/packages/pionia-pionia-app/feed)WikiDiscussions v3.0.0 Synced 2w ago

READMEChangelog (10)Dependencies (7)Versions (16)Used By (0)

Pionia Application (`pionia/pionia-app`)
========================================

[](#pionia-application-pioniapionia-app)

Official **Pionia v3** application template. Moonlight REST API on **PHP 8.5+** with `AppRealm` bootstrap, CLI, optional Vite frontend, and optional RoadRunner workers.

Create a project
----------------

[](#create-a-project)

```
composer create-project pionia/pionia-app my-api
cd my-api
php pionia serve
```

Default URL: `http://127.0.0.1:8000/` (`environment/.env` → `PORT`; `[roadrunner]` in `settings.ini` uses the same default).

API (Moonlight)
---------------

[](#api-moonlight)

Register services in `switches/MainSwitch.php`. Dispatch with JSON:

```
{ "service": "welcome", "action": "ping" }
```

EndpointMethodPurpose`/api/v1/ping`GETFramework health check`/api/v1/`POSTService actions```
curl -s http://127.0.0.1:8000/api/v1/ping
curl -s -X POST http://127.0.0.1:8000/api/v1/ \
  -H 'Content-Type: application/json' \
  -d '{"service":"welcome","action":"ping"}'
```

Use path helpers in code — not hard-coded strings: `apiVersionPath()`, `apiPingPath()`, `apiBase()`.

Directory layout
----------------

[](#directory-layout)

```
bootstrap/          AppRealm + routes
environment/        .env, settings.ini
public/             Web root (index.php)
services/           Business logic (*Action methods)
switches/           ApiSwitch subclasses (service registry per API version)
storage/            cache, logs
worker.php          RoadRunner worker entry
.rr.yaml            RoadRunner config (HTTP + jobs)
pionia              CLI entry

```

`middlewares/`, `authentications/`, and `commands/` are created when you run `make:middleware`, `make:auth`, or `make:command`.

### Base classes (extend these)

[](#base-classes-extend-these)

KindClassSwitch`Pionia\Http\Switches\ApiSwitch`Service`Pionia\Http\Services\Service`Authentication`Pionia\Auth\Authentication`Middleware`Pionia\Middlewares\Middleware`Command`Pionia\Console\Command`Frontend (optional)
-------------------

[](#frontend-optional)

```
php pionia frontend:scaffold --framework=react-ts --yes
php pionia serve              # terminal 1 — API on PORT (8000)
php pionia frontend:dev       # terminal 2 — Vite on :5173, proxies /api
php pionia frontend:build     # production — copies dist/ → public/
```

CORS for `:5173` is preconfigured in `environment/settings.ini`.

Background work
---------------

[](#background-work)

Post-response tasks (logging, webhooks) — **not a new thread**; runs after the client gets JSON:

```
defer(function () use ($order) {
    logger()->info('Processed after response', ['id' => $order->id]);
});
```

Requires `composer require react/promise`. Durable jobs (email, reports) use RoadRunner Jobs — see [Background work](https://pionia.netlify.app/documentation/background-work/).

RoadRunner (persistent workers)
-------------------------------

[](#roadrunner-persistent-workers)

RoadRunner packages ship in **require-dev**. After `composer install`:

```
php pionia rr:setup        # downloads ./rr binary (alias: composer rr:setup)
php pionia runserver       # foreground on http://127.0.0.1:8000
php pionia runserver --detach
php pionia runserver:logs
php pionia stopserver
```

Enable Moonlight jobs in `environment/settings.ini` (`[jobs] ENABLED=true`) when using the jobs pool.

Port resolution: CLI `--port` → `.env` `PORT` / `SERVER_PORT` → `[roadrunner]` in `settings.ini` → `.rr.yaml` → **8000**.

Production: switch `jobs.pipelines.moonlight` to **redis** in `.rr.yaml` and set `[jobs] ENABLED=true`.

Production performance (OPcache, opt-in)
----------------------------------------

[](#production-performance-opcache-opt-in)

Performance files are **not** shipped in the default template. Run once on deploy:

```
composer install --no-dev -o
php pionia optimize
```

This installs `bootstrap/preload.php`, `environment/php.ini.production.example`, and `[performance]` in `settings.ini`, then generates `storage/bootstrap/preload.php`.

- Point `php.ini` `opcache.preload` at `bootstrap/preload.php`
- Restart RoadRunner or PHP-FPM after deploy
- `php pionia optimize:clear --scaffold` removes opt-in files

RoadRunner without global `php.ini`:

```
server:
  command: "php -d opcache.enable_cli=1 -d opcache.preload=./bootstrap/preload.php worker.php"
```

API documentation
-----------------

[](#api-documentation)

Document actions with `@moonlight-*` PHPDoc on service classes:

```
php pionia api:docs --ui
open http://127.0.0.1:8000/docs    # when DEBUG or DOCS_ENABLED
```

Remove the path repository before publishing a Packagist release (consumers install core from Packagist).

Documentation
-------------

[](#documentation)

ResourceURLUser guides[pionia.netlify.app](https://pionia.netlify.app)Helpers (`defer`, Porm, cache, …)[Helpers](https://pionia.netlify.app/documentation/helpers/)Framework architecture[PioniaCore AGENTS.md](https://github.com/PioniaPHP-project/PioniaCore/blob/main/AGENTS.md)This app`AGENTS.md` (short app notes)Requirements
------------

[](#requirements)

- PHP **8.5+**
- Composer
- `pionia/pionia-core` **^3.0**
- `ext-pdo` (SQLite default; configure other drivers in `settings.ini`)

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance90

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~60 days

Recently: every ~162 days

Total

14

Last Release

46d ago

Major Versions

v1.1.3 → v2.0.02024-09-22

v2.0.2 → v3.0.0-beta2026-07-02

PHP version history (2 changes)v1.0.0PHP &gt;=8.1

v3.0.0-betaPHP &gt;=8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/43230268?v=4)[Tumusiime Ezra](/maintainers/jet2018)[@jet2018](https://github.com/jet2018)

---

Top Contributors

[![jet2018](https://avatars.githubusercontent.com/u/43230268?v=4)](https://github.com/jet2018 "jet2018 (68 commits)")

---

Tags

fastframeowrkmoonlightphp-fpmphp-frameworkphp8restful

### Embed Badge

![Health badge](/badges/pionia-pionia-app/health.svg)

```
[![Health](https://phpackages.com/badges/pionia-pionia-app/health.svg)](https://phpackages.com/packages/pionia-pionia-app)
```

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k199.6M3.4k](/packages/composer-composer)[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

43.6k344.8k1](/packages/ccxt-ccxt)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k434.3k26](/packages/team-reflex-discord-php)[web3p/web3.php

Ethereum web3 interface.

1.3k375.9k43](/packages/web3p-web3php)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136411.0k14](/packages/rector-rector-src)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k17.3k100](/packages/elgg-elgg)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
