Requirements & Installation
1 · System Requirements
Stack piece | Minimum | Notes |
---|---|---|
PHP | 8.4 (or newer) | Compile with --enable-opcache for prod. |
Extensions | pdo_mysql, json, mbstring, openssl | Plus any driver you use (e.g. pdo_pgsql). |
Database | MySQL 8.0 / MariaDB 10.6 | SQLite & PostgreSQL support are on the roadmap. |
Web server | Nginx 1.20+ or Apache 2.4 (mod_php or FPM) | Dev server needs nothing—see §4. |
Composer | 2.7+ | For dependency resolution & autoload generation. |
Node (optional) | 20+ | Only if you plan to use Vite/Tailwind for front-end assets. |
Memory footprint: a minimal install with OPcache enabled consumes ≈ 25 MB RAM per PHP worker.
2 · Quick Start (recommended)
composer create-project monkeyscloud/monkeyslegion-skeleton myapp
cd myapp
cp .env.example .env # or export vars however you prefer
php vendor/bin/ml key:generate # RSA keypair for JWT
php vendor/bin/ml serve --open # hot-reload dev server
The skeleton pulls in every first-party package—Core, Router, HTTP, etc.—plus
resources/, config/, database/ folders laid out for you.
Browse to http://localhost:8000 and you should see “Hello MonkeysLegion!”.
3 · Installing from Scratch (manual)
If you want a bare-bones install inside an existing repository:
Require individual packages
composer require \
monkeyscloud/monkeyslegion-core \
monkeyscloud/monkeyslegion-router \
monkeyscloud/monkeyslegion-http \
monkeyscloud/monkeyslegion-di
Create a public entrypoint
public/index.php
require_once dirname(__DIR__).'/vendor/autoload.php';
$container = (new MonkeysLegion\DI\ContainerBuilder())->build();
$router = $container->get(MonkeysLegion\Router\Router::class);
$kernel = new MonkeysLegion\Http\MiddlewareDispatcher();
$kernel->add($router->getMiddleware());
$response = $kernel->handle(
Laminas\Diactoros\ServerRequestFactory::fromGlobals()
);
(new Laminas\HttpHandlerRunner\Emitter\SapiEmitter())->emit($response);
Point Nginx or Apache to public/.
Add packages incrementally: Template, Entity, Auth, etc.
4 · Development Server
php vendor/bin/dev-server --open # or: php vendor/bin/ml serve
Auto-reloads on file change (templates, PHP, assets).
Serves static files from public/.
Injects a websocket snippet for live refresh.
5 · Production Deployment
Compile dependencies
composer install --no-dev --optimize-autoloader
Cache config & views
php vendor/bin/ml config:cache
php vendor/bin/ml view:clear
Migrate DB
php vendor/bin/ml migrate --env=prod
Run via PHP-FPM
Sample Nginx block:
server {
listen 443 ssl;
server_name app.example.com;
root /var/www/myapp/public;
index index.php;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Add a reverse-proxy cache (Cloudflare, FastCGI cache, etc.) if you serve mostly HTML pages.
6 · Optional PHP Extensions
Extension | Why you might want it |
---|---|
apcu | Faster in-memory cache backend than disk. |
redis | Production-grade session & queue store. |
imagick | Dynamic image manipulation in uploads. |
swoole | Long-running workers / WebSockets (community recipe). |
All packages degrade gracefully—install when you need them.
Next Steps
Create your first Entity & migration → continue with the Database tutorial.
Add authentication → see the Auth package docs.
Hook Grafana & Prometheus → follow Telemetry setup.
Happy shipping! 🚀