Pairity/README.md
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

2 KiB
Raw Permalink Blame History

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