A partitioned model ORM. Handles DAO and DTO objects
Go to file
Funky Waddle 9455d31904
Some checks failed
CI / test (8.2) (push) Has been cancelled
CI / test (8.3) (push) Has been cancelled
update ext-mongodb to correct version
2026-01-07 16:59:56 -06:00
.github/workflows update ext-mongodb to correct version 2026-01-07 16:59:56 -06:00
bin Cache and some other things 2026-01-06 10:56:40 -06:00
examples Docs/examples/CI polish 2025-12-11 07:37:40 -06:00
src Revert MongoDB support to 1.x 2026-01-07 12:48:58 -06:00
tests Cache and some other things 2026-01-06 10:56:40 -06:00
.gitignore Revert MongoDB support to 1.x 2026-01-07 12:48:58 -06:00
CHANGELOG.md Revert MongoDB support to 1.x 2026-01-07 12:48:58 -06:00
composer.json update ext-mongodb to correct version 2026-01-07 16:59:56 -06:00
composer.lock update ext-mongodb to correct version 2026-01-07 16:59:56 -06:00
LICENSE Initial commit 2025-12-09 22:00:02 +00:00
MILESTONES.md Get Production ready 2026-01-06 13:01:31 -06:00
phpunit.xml.dist fix testing 2025-12-11 09:19:41 -06:00
README.md update ext-mongodb to correct version 2026-01-07 16:59:56 -06:00
SPECS.md Cache and some other things 2026-01-06 10:56:40 -06:00

Pairity

A partitionedmodel PHP ORM (DTO/DAO) with Query Builder, relations, raw SQL helpers, and a portable migrations + schema builder.

CI Packagist

Installation

  • Requirements: PHP >= 8.2, PDO extension for your database(s)
  • Install via Composer:
composer require getphred/pairity

After install, you can use the CLI at vendor/bin/pairity.

Testing

This project uses PHPUnit 10. The default test suite excludes MongoDB integration tests by default for portability.

  • Install dev dependencies:
composer install
  • Run the default suite (SQLite + unit tests; Mongo tests excluded by default):
vendor/bin/phpunit
  • Run MongoDB integration tests (requires ext-mongodb >= 1.21 and a reachable server):
MONGO_HOST=127.0.0.1 MONGO_PORT=27017 vendor/bin/phpunit --group mongo-integration

Quick Start

Minimal example with SQLite and a simple users DAO/DTO.

use Pairity\Database\ConnectionManager;
use Pairity\Model\AbstractDto;
use Pairity\Model\AbstractDao;

// 1) Connect
$conn = ConnectionManager::make([
    'driver' => 'sqlite',
    'path'   => __DIR__ . '/db.sqlite',
]);

// 2) Define DTO + DAO
class UserDto extends AbstractDto {}
class UserDao extends AbstractDao {
    public function getTable(): string { return 'users'; }
    protected function dtoClass(): string { return UserDto::class; }
}

// 3) CRUD
$dao = new UserDao($conn);
$created = $dao->insert(['email' => 'a@b.com', 'name' => 'Alice']);
$user = $dao->findById($created->id);

For more detailed usage and technical specifications, see SPECS.md.

Documentation

Contributing

This is an early foundation. Contributions, discussions, and design proposals are welcome. Please open an issue to coordinate larger features.

License

MIT