pushinbr / pam-contracts
Stable PHP contracts for the Pam persistent runtime.
Requires
- php: ^8.4
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- v0.1.47
- v0.1.46
- v0.1.45
- v0.1.44
- v0.1.43
- v0.1.42
- v0.1.41
- v0.1.40
- v0.1.39
- v0.1.38
- v0.1.37
- v0.1.36
- v0.1.35
- v0.1.34
- v0.1.33
- v0.1.32
- v0.1.31
- v0.1.30
- v0.1.29
- v0.1.28
- v0.1.27
- v0.1.26
- v0.1.25
- v0.1.24
- v0.1.23
- v0.1.22
- v0.1.21
- v0.1.20
- v0.1.19
- v0.1.18
- v0.1.17
- v0.1.16
- v0.1.15
- v0.1.14
- v0.1.13
- v0.1.12
- v0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-brand/pam-mascot
- dev-docs/readme
This package is auto-updated.
Last update: 2026-11-09 16:07:59 UTC
README
Depend on the extension boundary, not an entire framework.
Small, versioned interfaces for applications, middleware, providers, stability and runtime compatibility.
Install · Quick example · API · Docs · Issues
Install
Most applications receive this package transitively. Extension authors install it explicitly inside a PAM project:
pam composer require pushinbr/pam-contracts pam doctor
New to PAM? Start with pam init my-app --template http and pam dev. Run pam doctor after dependency changes and before a release. The project stays a normal Composer project: standard manifest, lockfile, PSR-4 autoloading and vendor/autoload.php.
Quick example
<?php declare(strict_types=1); use Pam\Contracts\Http\ApplicationInterface; use Pam\Contracts\Http\MiddlewareInterface; use Pam\Contracts\Http\RequestHandlerInterface; use Pam\Contracts\Package\ServiceProviderInterface; use Pam\Contracts\Runtime\RuntimeCompatibility; use Pam\Http\Request; use Pam\Http\Response; final class AuditMiddleware implements MiddlewareInterface { public function process(Request $request, Response $response, RequestHandlerInterface $next): Response { // Inspect the request, then delegate to the next handler. return $next->handle($request, $response); } } final class AuditServiceProvider implements ServiceProviderInterface { public function register(ApplicationInterface $application): void { $application->middleware(new AuditMiddleware()); } public function boot(ApplicationInterface $application): void { // Fails fast when the package runs on an incompatible PAM runtime ABI. RuntimeCompatibility::discover()->assert(); } }
RuntimeCompatibility::discover() reads the ABI version and capabilities from the PAM runtime (Pam\Native\Api) and throws outside it. Pass a list of Pam\Native\Capability cases to assert() to require specific runtime features.
Why this exists
Small, versioned contracts for packages that extend PAM. It contains the HTTP application and middleware contracts, service providers, stability values and native runtime compatibility checks. It does not contain a router or server.
| Role | Foundation contract |
| Execution path | Strict PHP interfaces |
| This repository owns | Stable extension contracts shared across PAM packages |
| Boundary | No router, server, framework, or application implementation |
What you can build:
- Publishing framework-independent PAM extensions
- Testing runtime compatibility explicitly
- Sharing middleware and provider contracts without pulling a router
API guide
| Surface | Use it for |
|---|---|
Http\ApplicationInterface |
Minimal route, middleware, error, and in-memory handling contract. |
Http\MiddlewareInterface |
Process a request and delegate to the next handler. |
Http\RequestHandlerInterface |
Handle PAM request/response values. |
Package\ServiceProviderInterface |
Register and boot package integrations. |
Runtime\RuntimeCompatibility |
Discover ABI/capabilities and assert required runtime features. |
Runtime\Stability |
Represent the documented contract maturity (Experimental, Stable, Deprecated). |
All classes live under Pam\Contracts\. This package intentionally contains no router, server, or application implementation. Depend on it when publishing reusable PAM extensions that need stable contracts without forcing PAM HTTP on consumers.
Production checklist
- Keep request data and mutable state scoped to the current request.
- Test success, validation failure, exception, cancellation, and timeout paths.
- Configure explicit limits and avoid unbounded payloads, queues, or retained collections.
- Run
pam doctor,pam test, and the relevant integration suite before release. - Validate real dependencies and workload behavior; compatibility is not inferred from package installation alone.
Troubleshooting
- Class not found: run
pam composer install, verify PSR-4 configuration, and rerunpam doctor. - Behavior differs over the network: reproduce with PAM's transport integration tests; in-memory execution does not model the socket boundary.
- A dependency blocks a worker: use PAM-native I/O, a compatible event loop, a process pool, or additional isolated workers.
Docs
- PAM introduction
- Package ecosystem
- Runtime compatibility
- Report an issue: report security vulnerabilities through GitHub private vulnerability reporting or the PAM security policy, not a public issue
Part of the PAM ecosystem
PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.
| PAM | PAM Desktop | PAM Native | Ecosystem |
|---|---|---|---|
| the runtime and CLI | native desktop apps in PHP | native Android and iOS apps in PHP | every official package and plugin |
Docs: push-in.github.io/pam-docs · Issues
Apache License 2.0 · free and open source, including commercial use · Made in Brazil by Pushin