viames / pair
Lightweight PHP framework for fast server-rendered web applications with MVC routing, ActiveRecord ORM and API tooling
Requires
- php: ^8.4.1
- ext-curl: *
- ext-intl: *
- ext-json: *
- ext-mbstring: *
- ext-pdo: *
- ext-pdo_mysql: *
- psr/log: ^1.1 || ^2.0 || ^3.0
Requires (Dev)
- phpunit/phpunit: ^13.0
Suggests
- ext-fileinfo: Recommended for reliable MIME detection in uploads.
- ext-openssl: Required for Passkey/WebAuthn features.
- ext-redis: Recommended for Redis-backed cache/session integrations.
- ext-xdebug: Useful while debugging Pair applications and tests.
- aws/aws-sdk-php: Required by Pair\Services\AmazonS3 for AWS S3 and S3-compatible object storage.
- stripe/stripe-php: Required by Pair\Services\StripeGateway for Stripe payments.
Provides
None
Conflicts
None
Replaces
None
- dev-main / 4.x-dev
- 4.1.12
- 4.1.11
- 4.1.10
- 4.1.9
- 4.1.8
- 4.1.7
- 4.1.6
- 4.1.5
- 4.1.4
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.0
- v3.x-dev
- 3.0.1
- 3.0.0
- v2.x-dev
- 2.0.0
- 2.0.0-beta
- 2.0.0-alpha
- v1.x-dev
- 1.9.18
- 1.9.17
- 1.9.16
- 1.9.15
- 1.9.14
- 1.9.13
- 1.9.12
- 1.9.11
- 1.9.10
- 1.9.9
- 1.9.8
- 1.9.7
- 1.9.6
- 1.9.5
- 1.9.4
- 1.9.3
- 1.9.2
- 1.9.1
- 1.9
- 1.8.24
- 1.8.23
- 1.8.22
- 1.8.21
- 1.8.20
- 1.8.19
- 1.8.18
- 1.8.17
- 1.8.16
- 1.8.15
- 1.8.14
- 1.8.13
- 1.8.12
- 1.8.11
- 1.8.10
- 1.8.9
- 1.8.8
- 1.8.7
- 1.8.6
- 1.8.5
- 1.8.4
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8
- 1.7.22
- 1.7.21
- 1.7.20
- 1.7.19
- 1.7.18
- 1.7.17
- 1.7.16
- 1.7.15
- 1.7.14
- 1.7.13
- 1.7.12
- 1.7.11
- 1.7.10
- 1.7.9
- 1.7.8
- 1.7.7
- 1.7.6
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.9
- 1.6.8
- 1.6.7
- 1.6.6
- 1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.18
- 1.5.17
- 1.5.16
- 1.5.15
- 1.5.14
- 1.5.13
- 1.5.12
- 1.5.11
- 1.5.10
- 1.5.9
- 1.5.8
- 1.5.7
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.9
- 1.4.8
- 1.4.7
- 1.4.6
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.0
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.0
This package is auto-updated.
Last update: 2026-11-07 11:34:16 UTC
README
A lightweight PHP framework for maintainable, server-rendered applications.
Website · Documentation · Starter project · Releases · Security
Pair is designed for small and medium PHP/MySQL applications where clear architecture, low operational overhead and long-term maintainability matter more than a heavy frontend toolchain.
It combines explicit MVC responses, an ActiveRecord-style ORM, CRUD and OpenAPI tooling, progressive enhancement, authentication helpers and conservative upgrade tooling in a codebase intended to remain inspectable by both people and AI-assisted workflows.
Quick start · Application development · Requirements · Documentation · Development
Status
| Line | Status | Use |
|---|---|---|
| Pair 4 releases | Stable | New and current applications |
Pair 4 main |
Unreleased | Framework development and upcoming changes |
| Pair 3 | Maintenance | Existing applications awaiting migration |
The current stable release is Pair 4.1.12.
Pair 4 is used in production across the maintainer's applications. The release history lists published versions; see the upgrade guide for migration from earlier lines.
Quick start
With the requirements installed, create an application with authentication, ACL, migrations and localization:
composer create-project viames/pair_boilerplate my-project
cd my-project
The stable starter 4.0.0
requires Pair ^4.1.12. Composer resolves stable dependencies and creates the new
application's own composer.lock; commit that lock with your application.
- Serve the project through Apache with
mod_rewriteand.htaccessoverrides enabled. If it is inside your local document root, openhttp://localhost/my-project/; otherwise use your configured virtual-host URL. See the starter setup for the Apache configuration. - Follow the browser installer using a dedicated new or empty MySQL database
and an account permitted to initialize it. The installer imports the schema and seed data,
writes
.envand creates the first administrator. It requiresfileinfoin addition to the framework's required PHP extensions. - Log in with the generated credentials, change the initial password and run the administrator's Self test module.
For an existing application, install the framework directly:
composer require "viames/pair:^4.1.12"
Then follow the bootstrap guide
and environment reference
to configure its database and public/index.php.
Why Pair
- Explicit controllers, typed page state and page, fragment, JSON, text and empty responses
- ActiveRecord persistence, casting, relations and collections
- Forms, validation, CSRF, authentication, ACL and sessions
- API and CRUD tooling with explicit read models and OpenAPI contracts
- PairUI progressive enhancement, PWA, push and passkeys without a mandatory frontend build
- Native iOS/Android helpers and optional integrations
- Conservative upgrade tooling, logging, diagnostics and tests across supported PHP versions
A Pair 4 page
An explicit controller passes a named, immutable state object to its layout.
These files belong to an application's modules/welcome/ directory.
classes/WelcomePageState.php:
<?php /** Data rendered by the welcome page. */ final readonly class WelcomePageState { /** Create the page state. */ public function __construct(public string $message) {} }
controller.php:
<?php use Pair\Web\Controller; use Pair\Web\PageResponse; require_once __DIR__ . '/classes/WelcomePageState.php'; /** Render the welcome module. */ final class WelcomeController extends Controller { /** Return the default page with explicit state. */ public function defaultAction(): PageResponse { return $this->page('default', new WelcomePageState('Hello Pair'), 'Welcome'); } }
layouts/default.php:
<main> <h1><?= htmlspecialchars($state->message, ENT_QUOTES, 'UTF-8') ?></h1> </main>
Default routes use the form /<module>/<action>/<params...>. Legacy Pair
controllers and views remain available as migration bridges, while new Pair 4
modules should use explicit response contracts.
For a complete controller/state/layout example, see the implementation patterns.
Application development
In the starter project, run generators through its local CLI wrapper:
composer run pair -- make:module orders composer run pair -- make:api catalogapi composer run pair -- make:crud order --table=orders --fields=id,customer_id,total_amount
Choose unused module names and review generated code using the
generator guide.
For an existing application's major-version upgrade, follow
UPGRADE_V4.md, start from
a clean working tree or verified backup, and pass --dry-run explicitly before
writing changes. Tool mode defaults differ between upgrade generations.
Requirements
- PHP 8.4.1 or later within PHP 8.x; PHP 8.5 recommended
- MySQL 8.0 or later for the default database driver
- Composer 2
- Apache 2.4 with
mod_rewritefor the standard web setup - PHP extensions:
curl,intl,json,mbstring,pdo,pdo_mysql
Pair 4.1.12 supports MySQL 26.10 alongside MySQL 8.0/8.4 and uses utf8mb4
connection defaults. The test matrix is described under Development.
See the database reference
and upgrade notes
for connection behavior, existing schema requirements and rollout guidance.
Feature-specific extensions are optional for the core runtime: fileinfo for
MIME detection, openssl for passkeys, redis for Redis integrations and
xdebug for debugging. AWS S3 and Stripe integrations also require their
respective SDKs; see Integrations.
Development
For framework contributors, start with AGENTS.md and the source map. Run checks from the framework checkout:
composer install
composer test
composer test:install
The installation check
tests real Composer archives and consuming projects offline. Add
-- ../pair_boilerplate to verify stable starter creation as well; it needs
the development-only PHP zip extension. Optional database checks use a guarded
disposable schema and never read an application's credentials.
Database compatibility has a separate real-server suite: composer test:mysql.
Provision a disposable schema and a restricted account using the
MySQL integration guide.
The configured CI matrix targets PHP 8.4/8.5 with MySQL 8.0, 8.4 and 26.10;
the unit suite does not require a MySQL server.
Use composer run benchmark-v4 for migration/performance checks when relevant.
For internals, see the architecture and database metadata cache. For publication, follow the release workflow and Composer package contents.
Documentation
Choose a guide by task:
| Task | Guide |
|---|---|
| Start an application | Starter project, bootstrap, configuration |
| Build modules and APIs | Wiki learning paths and class reference, generator |
| Upgrade an application | Pair 4 upgrade guide |
| Contribute to Pair | Framework development, implementation patterns |
For native clients, start with mobile auth setup, then the iOS or Android guide.
The wiki follows main and may document unreleased changes. Compare examples
with the source for the Pair version installed in your application.
Maintainer
Pair is created and maintained by Viames Marino. His professional practice, VM Ingegneria, covers external technical direction, software modernization and governed AI integration.
For a professional project, use the VM Ingegneria contact form. For framework usage and contributions, use the documentation and repository channels above.
Security
Report vulnerabilities privately by following SECURITY.md. Do not open a public issue for an unassessed security report.
Contributing
Focused pull requests are welcome. Include tests when behavior changes and update the owning documentation when commands, requirements or public contracts change.
License
MIT