viames / pair
lightweight PHP framework as the air
Installs: 1 838
Dependents: 1
Suggesters: 0
Security: 0
Stars: 10
Watchers: 4
Forks: 2
Open Issues: 0
pkg:composer/viames/pair
Requires
- php: ^8.3||^8.4||^8.5
- ext-curl: *
- ext-intl: *
- ext-json: *
- ext-mbstring: *
- ext-pdo: *
- psr/log: ^1.1|^2.0|^3.0
Suggests
- ext-xdebug: *
- dev-main
- 3.0.0-alpha
- v2.x-dev
- 2.0.0
- 2.0.0-beta
- 2.0.0-alpha
- v1.x-dev
- 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: 2025-11-05 15:04:43 UTC
README
What’s new
Welcome to Pair version 3 alpha. This is a major release that breaks compatibility with previous versions.
Features
Pair is a simple and fast PHP framework with little or no frills. It was written with simplicity in mind, trying to satisfy the most frequent needs of web applications. It implements the Model-View-Controller pattern and intuitive, search engine friendly routing by default.
Everyone knows that you don’t need a truck to go grocery shopping. You don't even need a car to go to the local newsstand to buy the newspaper. You need the right vehicle for every occasion.
If starting a new web project is a hassle because of the complexity and slowness of the famous pachyderm frameworks used around, you should take a look at Pair. For a small or medium web project, it might surprise you.
Pair learns the referential constraints of database tables and automatically uses magic functions to reuse the data already read via cache. While Pair sends the complete web page to the browser, some of the most popular frameworks still have to load all the server-side libraries.
Additionally using Pair's advanced features for efficiently managing information already extracted from the DB, you can create a web page of an application that reads millions of records and numerous related tables in the incredible time of just 10 ms.
Pair supports third-party products and services to make it easy to create lightning-fast server-side web applications, including: Amazon S3, Amazon SES, Chart.js, ELK logger, InsightHub, Sentry, Telegram.
ActiveRecord
Pair allows the creation of objects related to each respective database table using the ActiveRecord class. Objects retrieved from the DB are cast in both directions to the required type (int, bool, DateTime, float, csv). See Automatic properties cast page in the wiki.
In addition, each class inherited from ActiveRecord supports many convenient methods including those for caching data that save queries.
The Pair base tables are InnoDB utf-8mb4.
Plugins
Pair supports modules and templates as installable plugins, but can easily be extended to other types of custom plugins. The Pair’s Plugin class allows you to create the manifest file, the ZIP package with the contents of the plugin and the installation of the plugin of your Pair’s application.
Time zone
The automatic time zone management allows to store the data on UTC and to obtain it already converted according to the connected user’s time zone automatically.
Log bar
A nice log bar shows all the details of the loaded objects, the system memory load, the time taken for each step and for the queries, the SQL code of the executed queries and the backtrace of the detected errors. Custom messages can be added for each step of the code.
Installation
Composer
composer require viames/pair
After having installed Pair framework you can get singleton object $app and the just start MVC. You can check any session before MVC, like in the following example.
use Pair\Core\Application; // initialize composer require 'vendor/autoload.php'; // intialize the Application $app = Application::getInstance(); // start controller and then display $app->run();
If you want to test code that is in the master branch, which hasn’t been pushed as a release, you can use master.
composer require viames/pair dev-main
If you don’t have Composer, you can download it.
Documentation
Please consult the Wiki of this project. Below are its most interesting pages that illustrate some features of Pair.
Requirements
| Software | Recommended | Minimum | Configuration |
|---|---|---|---|
| Apache | 2.4+ | 2.2 | modules: mod_rewrite |
| MySQL | 9.3 | 8.0 | character_set: utf8mb4 collation: utf8mb4_unicode_ci storage_engine: InnoDB |
| PHP | 8.4 | 8.3 | extensions: fileinfo, json, pcre, PDO, pdo_mysql, Reflection |
Examples
The pair_boilerplate is a good starting point to build your new web project in a breeze with Pair PHP framework using the installer wizard.
Contributing
Feedback, code integration, and documentation adjustments are welcome.
If you would like to contribute to this project, please feel free to submit a pull request.
License
MIT
