A lightweight, fast PHP microframework for building APIs quickly.
- Simple: Minimal concepts. Define routes and controllers that return arrays.
- Fast: Tiny core with zeroheavy dependencies at runtime.
- Modern: PSR-4, middleware, JSON-first, PDO-ready,
.env
support. - Productive: Built-in CLI to scaffold controllers/models/modules.
- PHP >= 8.1
- ext-PDO (e.g., pdo_mysql)
Option A — Create a fresh project (recommended):
composer create-project quikapi/framework my-api
cd my-api
# .env will be auto-copied by composer scripts; if not:
cp .env.example .env
Option B — Use in an existing repo:
composer install
cp .env.example .env
Then edit .env
for your DB and CORS settings.
Run QuikAPI on PHP's built-in server:
php -S 127.0.0.1:8082 QuikAPI/server.php
Visit http://127.0.0.1:8082/health
→
{"status":"ok","time":"..."}
Add routes in QuikAPI/routes.php
:
use QuikAPI\Controllers\HealthController;
$router->get('/health', [HealthController::class, 'index']);
Supported verbs: get
, post
, put
, patch
, delete
.
Path params: /users/{id}
→ available in $req->params['id']
.
Controllers are simple classes returning arrays. Example:
namespace QuikAPI\Controllers;
use QuikAPI\Http\Request;
class UserController {
public function index(Request $req): array { return ['items' => []]; }
public function show(Request $req): array { return ['id' => $req->params['id'] ?? null]; }
}
Global middleware is registered in QuikAPI/index.php
:
QuikAPI\Middleware\ErrorHandler
→ JSON error responsesQuikAPI\Middleware\Cors
→ CORS headers / OPTIONS
You can also pass route-specific middleware in Router::add()
.
Configure in .env
:
DB_DSN=mysql:host=127.0.0.1;dbname=app;charset=utf8mb4
DB_USER=root
DB_PASS=
Use QuikAPI\Database\Connection::get()
to obtain a shared PDO instance.
Use QuikAPI\Security\Password
for password hashing and verification:
$hash = Password::hash($plain);
$ok = Password::verify($plain, $hash);
Built-in simple CLI to scaffold modules:
php quikapi make:controller User
php quikapi make:model User
php quikapi make:module Post
This will append REST routes to QuikAPI/routes.php
and create the controller/model.
QuikAPI/
Controllers/
Database/
Http/
Middleware/
Security/
routes.php
index.php
server.php
cli.php
- Symfony Console based CLI (route:list, serve, etc.)
- Request/Response interfaces and typed responses
- Validation utilities
- Auth middleware (JWT/session)
- Branching: Default branch is
master
. Dev stability via branch-aliasdev-master
→0.1.x-dev
. - Versioning: Semantic Versioning. Breaking changes only in major releases.
- Backward compatibility: No breaking changes in minor releases; deprecations announced one minor before removal.
- Security: See
SECURITY.md
and report privately before disclosure.
MIT