AeroPHP is a lightweight, high-performance, API-only PHP framework designed for building microservices and high-concurrency applications.
- 🚀 Async I/O - Built on Swoole for non-blocking, coroutine-based execution
- 📦 PSR Compliant - PSR-4, PSR-7, PSR-11, PSR-15 standards
- ⚡ Zero Bloat - API-only focus, no sessions, views, or frontend tooling
- 🔧 DI Container - Pre-compiled container for zero runtime reflection overhead
- 🛣️ Attribute Routing - Define routes with PHP 8 attributes
- 🗄️ Async ORM - Connection pooling with SQLite (default), MySQL, and PostgreSQL support
- 📊 Microservices Ready - Service discovery, health checks, Prometheus metrics
- 🔄 State Isolation - Request-scoped containers prevent memory leaks
- PHP 8.2+
- Swoole extension (recommended) or RoadRunner
- Composer
composer create-project aerophp/framework my-project
cd my-project
cp .env.example .env# With Swoole (recommended)
php server.php
# Development mode (PHP built-in server)
php bin/aero servephp bin/aero make:controller ProductController<?php
namespace App\Controllers;
use Aero\Routing\Attributes\{Get, Post, Put, Delete};
use Aero\Http\JsonResponse;
final class ProductController extends Controller
{
#[Get('/api/products')]
public function index(): JsonResponse
{
return JsonResponse::success(Product::all());
}
#[Get('/api/products/{id}')]
public function show(int $id): JsonResponse
{
return JsonResponse::success(Product::find($id));
}
#[Post('/api/products')]
public function store(Request $request): JsonResponse
{
$product = Product::create($request->json());
return JsonResponse::created($product);
}
}// Connection pooling prevents blocking
$users = User::where('active', true)
->orderBy('created_at', 'DESC')
->limit(10)
->get();php bin/aero serve # Start development server
php bin/aero make:controller # Generate controller
php bin/aero make:model # Generate model (with -m for migration)
php bin/aero make:migration # Generate migration
php bin/aero migrate # Run migrations
php bin/aero migrate:rollback # Rollback last batch
php bin/aero migrate:status # Show migration status
php bin/aero routes:list # List all routesaerophp/
├── app/
│ ├── Controllers/ # HTTP controllers
│ ├── Models/ # Database models
│ ├── Middleware/ # Custom middleware
│ └── Providers/ # Service providers
├── bin/
│ └── aero # CLI tool
├── config/
│ ├── app.php # Application config
│ ├── database.php # Database config
│ └── services.php # Service discovery config
├── database/
│ └── migrations/ # Database migrations
├── public/
│ └── index.php # Traditional entry (optional)
├── src/ # Framework source
├── storage/
│ ├── cache/ # Compiled files
│ └── logs/ # Application logs
├── server.php # Swoole entry point
└── composer.json
Copy .env.example to .env and configure:
APP_NAME=MyAPI
APP_ENV=production
APP_DEBUG=false
SERVER_HOST=0.0.0.0
SERVER_PORT=8080
SERVER_WORKERS=4
# SQLite (default) - Just works out of the box!
DB_CONNECTION=sqlite
DB_DATABASE=./database/database.sqlite
# Or use MySQL
# DB_CONNECTION=mysql
# DB_HOST=127.0.0.1
# DB_DATABASE=myapp
# DB_USERNAME=root
# DB_PASSWORD=
# DB_POOL_SIZE=64GET /health
GET /metrics
Configure Consul or Etcd in .env:
SERVICE_DISCOVERY_DRIVER=consul
CONSUL_HOST=127.0.0.1
CONSUL_PORT=8500- State Pollution Prevention: Request-scoped containers isolate state
- Pre-compiled DI: Zero reflection overhead in production
- Connection Pooling: Async database without blocking
- SOLID Principles: Interface-driven, swappable components
MIT License