Pairity/README.md
Funky Waddle 68f3c05868
Some checks are pending
CI / test (8.2) (push) Waiting to run
CI / test (8.3) (push) Waiting to run
Cache and some other things
2026-01-06 10:56:40 -06:00

79 lines
2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Pairity
A partitionedmodel PHP ORM (DTO/DAO) with Query Builder, relations, raw SQL helpers, and a portable migrations + schema builder.
![CI](https://github.com/getphred/pairity/actions/workflows/ci.yml/badge.svg)
![Packagist](https://img.shields.io/packagist/v/getphred/pairity.svg)
## Installation
- **Requirements**: PHP >= 8.2, PDO extension for your database(s)
- **Install via Composer**:
```bash
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**:
```bash
composer install
```
- **Run the default suite** (SQLite + unit tests; Mongo tests excluded by default):
```bash
vendor/bin/phpunit
```
- **Run MongoDB integration tests** (requires `ext-mongodb >= 2.1` and a reachable server):
```bash
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.
```php
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](SPECS.md).
## Documentation
- [Specifications](SPECS.md)
- [Milestones & Roadmap](MILESTONES.md)
- [Examples](examples/)
## Contributing
This is an early foundation. Contributions, discussions, and design proposals are welcome. Please open an issue to coordinate larger features.
## License
MIT