Skip to the content.

Pair

A lightweight PHP framework for maintainable, server-rendered applications.

Website · Documentation · Starter project · Releases · Security

CI Total downloads Latest release License PHP requirement

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.

Status

Line Status Use
Pair 4 Stable New and current applications
Pair 3 Maintenance Existing applications awaiting migration

Pair 4.1.2 is the current stable release. Pair 4 is used in production across the maintainer’s applications. See Releases for version history and UPGRADE_V4.md for migration guidance.

Quick start

Install Pair 4.1.2 or a later compatible Pair 4 release:

composer require "viames/pair:^4.1.2"

Bootstrap the application in public/index.php after configuring its .env and database (see the setup guide):

<?php

use Pair\Core\Application;

require dirname(__DIR__) . '/vendor/autoload.php';

$app = Application::getInstance();
$app->run();

For authentication, ACL, migrations, localization and a ready-to-run application structure, start with the boilerplate:

composer create-project viames/pair_boilerplate my-project

Why Pair

A Pair 4 page

Pair 4 favors explicit responses over hidden view bootstrapping:

<?php

use Pair\Web\Controller;
use Pair\Web\PageResponse;

final class UserController extends Controller {

	public function defaultAction(): PageResponse {

		$state = new class ('Hello Pair') {

			public function __construct(public string $message) {}

		};

		return $this->page('default', $state, 'User');

	}

}

The corresponding layout stays presentation-focused:

<main class="user-page">
	<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.

Main capabilities

Web and data

APIs and clients

Progressive enhancement

PairUI adds lightweight data-* directives for text, visibility, attributes, events, models and repeated content. Additional helpers cover PWA installation, service workers, routing, skeleton states, validation, passkeys and push notifications while preserving server-rendered behavior.

See PairUI.js and the documentation index for examples.

Requirements

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

composer install
composer test
composer run benchmark-v4

Generate Pair 4 code from an application that has Pair installed:

vendor/bin/pair make:module orders
vendor/bin/pair make:api api
vendor/bin/pair make:crud order --table=orders --fields=id,customer_id,total_amount

Upgrade tools operate in dry-run mode first and report application-specific code that still requires manual migration. Follow UPGRADE_V4.md and begin from a clean working tree or verified backup.

Documentation

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