sirosoft / core
Core engine powering the Siro API Framework with minimal runtime surface.
Requires
- php: >=8.4.1
- ext-curl: *
- ext-fileinfo: *
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
- ext-pdo: *
Requires (Dev)
- cyclonedx/cyclonedx-php-composer: ^6.0
- infection/infection: ^0.35
- laminas/laminas-diactoros: ^3.0
- league/oauth2-server: ^9.5
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^13.4
- squizlabs/php_codesniffer: ^3.0
- vimeo/psalm: ^7.0
Suggests
- ext-redis: Required for Redis cache, session, and rate limiter drivers
- laminas/laminas-diactoros: PSR-7 implementation used by the OAuth2 bridge
- league/oauth2-server: Required for the OAuth2 authorization server (grants, PKCE, scopes)
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8.1
- v1.0.8
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.41.0
- v0.40.0
- 0.35.1
- v0.35.0
- v0.34.0
- v0.33.1
- v0.33.0
- v0.32.1
- v0.32.0
- v0.31.0
- dev-major/v2-l11-l13
- dev-release/v1.6.2
- dev-fix/post-v161-backlog
- dev-release/v1.6.1
- dev-fix/audit3-all
- dev-fix/audit2-cli-f1f2
- dev-fix/audit-c1-h8
- dev-fix/agent-wire-tool-calls
- dev-fix/ssrf-redirect-revalidation
- dev-release/v1.6.0
- dev-feature/v1.6.0-g9
- dev-release/v1.5.3
- dev-fix/phpcs-whole-repo
- dev-release/v1.5.2
- dev-release/v1.5.1
- dev-release/v1.5.0
- dev-feature/v1.5.0
- dev-fix/v1.4.2
- dev-fix/v1.4.1
- dev-release/v1.4.0-bump
- dev-fix/json-cast-compat
- dev-feature/v1.4.0
- dev-fix/schema-mysql-native-prepares
- dev-feature/v1.3-attributes-testdx
- dev-release/v1.1.0
- dev-feature/v1.2-upstream-batch
- dev-release/v1.0.14
- dev-feat/production-trace-capture
- dev-chore/release-quality-and-docs-clean
- dev-fix/parseheaders-fallback
- dev-fix/dogfood-quirks
- dev-fix/ci-release-gates
- dev-fix/queue-time-limit-and-enum-column
- dev-chore/identity-map-invalidation
- dev-docs/v040-changelog
This package is auto-updated.
Last update: 2026-12-01 09:28:07 UTC
README
⚡ Siro Core
Core engine powering the Siro API Framework.
Routing · ORM · CLI · Debug. Minimal runtime surface.
Install
# Standalone engine composer require sirosoft/core # Or with full skeleton (recommended) composer create-project sirosoft/api my-app
Quickstart (5 commands)
# 1. Create a project composer create-project sirosoft/api my-app cd my-app # 2. Generate a full CRUD API php siro make:crud products # 3. Run the migration + start the server php siro migrate php siro serve # 4. Test the endpoint php siro api:test GET /api/products # 5. When something fails — why? php siro why
The Killer Feature: Debug workflow (Why → Replay → Fix → Test)
Siro is built around understanding what happened, not just writing code.
php siro api:test POST /api/auth/login email=bad password=x # fails (422) php siro why # why? shows exception + middleware + SQL php siro replay <trace_id> # replay (safe: auto-executes safe requests) php siro replay <trace_id> --force # replay with side-effect risks (requires --force) php siro replay <trace_id> --diff # compare before/after a fix php siro replay <trace_id> --test # generate a regression test php siro fix # watcher: auto-replays on file change php siro test:regression # catch regressions across all traces
Every failed request writes a trace (request, response, SQL, outbound HTTP, timing, exception).
Before replaying, Siro analyzes the trace for side-effect risks — DB writes, external HTTP calls, queued jobs.
Risky traces are blocked by default and require --force to execute.
Replay it, diff it, turn it into a test. No other PHP framework does this.
Debug production in 1 command
php siro api:why POST /api/orders
Request
────────────────────────────────────────────────────────
Route: POST /api/orders
Status: ✗ 500
Duration: 143ms
Middleware Pipeline
└ ✗ OrderMiddleware 35ms ⚠ slow
SQL Queries
└ ⚠ UPDATE inventory 102ms ⚠ slow
Exception
PDOException: Deadlock found when trying to get lock
Possible Cause
• Concurrent transaction conflict
• Missing retry logic for deadlock scenarios
Suggested Fix
▸ Wrap transaction in retry loop (max 3 attempts)
Replay
[r] php siro replay id --force
[e] php siro replay id --edit
[d] php siro replay id --diff
[t] php siro make:test --from-trace=id
⚠ Side-effect risks detected: 2 DB writes, 1 outbound HTTP call
→ Replay blocked by default. Use --force to execute.
One command. Full context. Risk-aware replay. No other framework has this flow.
Full workflow
┌─────────────────┐
│ HTTP Request │
└────────┬────────┘
▼
┌─────────────────┐
│ Router (O(1)) │
└────────┬────────┘
▼
┌─────────────────┐
│ Middleware │
└────────┬────────┘
▼
┌─────────────────┐
│ Controller │
│ → Service │
│ → Model / DB │
└────────┬────────┘
▼
┌─────────────────┐
│ Resource / JSON │
└─────────────────┘
php siro make:crud Product # Build php siro why # Debug php siro replay --diff # Replay (risk-aware) php siro fix # Fix & auto-test
Features
| Layer | What's included |
|---|---|
| Router | O(1) static dispatch, regex dynamic, groups, middleware pipeline, PHP 8 Attributes |
| ORM | Active Record, HasOne/HasMany/BelongsTo/BelongsToMany, eager loading, soft deletes, identity map, N+1 detection |
| Auth | JWT (HS256/RS256), key rotation, per-token revocation, refresh rotation, API keys, RBAC |
| Security | CSP, CSRF, CORS, rate limiting (Redis/file), audit logging, OWASP Top 10 mitigated |
| CLI | 105 commands: make:crud, migrate, db:why, api:why, log:replay, test:regression, fix |
| Debug | Side-effect-aware request replay, outbound HTTP tracing, queue correlation, trace search (IP/path/status/time), api:why, db:why, N+1 detection, log sanitization |
| Database | Query Builder, Schema Builder, migrations, SQLite/MySQL/PostgreSQL, pagination, row locking |
| Cache | File + Redis drivers, HMAC-signed config cache |
| Queue | DB-based, exponential backoff, priority, timeout, failed job retry |
| SMTP (STARTTLS), sendmail, async queue, HTML + attachments | |
| Validation | 15+ rules, custom rules + messages, FormRequest |
| Storage | Local filesystem, S3-compatible |
| Events | Pub/sub, wildcards, one-time listeners, model lifecycle hooks |
| AI/MCP | Optional sirosoft/mcp-server integration — audited AI project context and safe coding workflow |
Performance
In-process re-boot (Linux, PHP 8.4, OPcache, no xdebug): ~0.5 ms avg
(min ~0.4 ms; ~6.5 ms avg with xdebug loaded)
Fresh-process cold start (interpreter + autoload + boot): ~85–120 ms
Route dispatch (full, pre-built request): ~0.06 ms (~16K ops/sec)
Memory (framework baseline, peak): ~4 MB allocated
Measured 30 Nov 2026 on the shared CI VM (PHP 8.4.28, Linux, OPcache
enabled) with scripts/bench-boot.php (50 iterations after 5 warmup) and
fresh php processes for the cold-start figure. The ~0.5 ms figure is a
warm, in-process re-boot minimum — it is NOT a cold start: a real cold
process start is ~85–120 ms, dominated by PHP startup and first-compile
(CLI OPcache has no cross-process cache). See BENCHMARK.md
for methodology and real HTTP throughput numbers.
Quality
| Gate | Result |
|---|---|
| PHPStan (Level Max) | 0 errors |
| Unit + Integration tests | 23,279 tests / 45,163 assertions — 0 failures (verified gate on the post-v1.6.1 fix round, unreleased, 30 Nov 2026; v1.6.1 released at 22,940 / 42,808) |
| Mutation testing | MSI ~83% (Auth 82%, Middleware 83%) — baseline measured at v0.40.0 (20 Aug 2026), not re-measured at v1.6.1; see COVERAGE.md |
| Composer audit | 0 vulnerabilities |
Requirements
- PHP 8.4.1+
ext-pdo,ext-json,ext-mbstring
Ecosystem
| Project | Description |
|---|---|
| SiroPHP | Full project skeleton — 7 controllers, 462 tests |
| siro-mcp-server | Optional AI agent integration — Claude/GPT/Copilot |
License
MIT — see LICENSE.