定制 getphred/pairity 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

getphred/pairity

最新稳定版本:0.2.0

Composer 安装命令:

composer require getphred/pairity

包简介

DAO/DTO-centric PHP ORM with Query Builder, relations (SQL + MongoDB), migrations/CLI, Unit of Work, and event system. Supports MySQL/MariaDB, PostgreSQL, SQLite, SQL Server, Oracle, and MongoDB.

README 文档

README

A partitioned‑model 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

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-11