PHPackages                             flytachi/winter-edo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. flytachi/winter-edo

ActiveLibrary[Database &amp; ORM](/categories/database)

flytachi/winter-edo
===================

Winter framework 'Entity of Database objects' component

v3.0.0(2mo ago)1295↓83.9%1MITPHPPHP &gt;=8.3

Since Dec 17Pushed 2mo agoCompare

[ Source](https://github.com/Flytachi/winter-edo)[ Packagist](https://packagist.org/packages/flytachi/winter-edo)[ Docs](https://winterframe.net)[ RSS](/packages/flytachi-winter-edo/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (6)Dependencies (10)Versions (20)Used By (1)

Winter EDO
==========

[](#winter-edo)

[![Latest Version on Packagist](https://camo.githubusercontent.com/52550022801254c141eb4b2f35506899c7eeb2e5b8ce6efec57e7f994e15b03c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666c7974616368692f77696e7465722d65646f2e737667)](https://packagist.org/packages/flytachi/winter-edo)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)

**EDO** (Entity of Database Objects) — the repository layer for the Winter framework. Wraps [Winter CDO](https://packagist.org/packages/flytachi/winter-cdo) with a fluent SQL query builder, entity hydration, and ready-made CRUD and read-only stereotypes.

**Full documentation:**

---

Requirements
------------

[](#requirements)

- PHP &gt;= 8.3
- ext-pdo
- flytachi/winter-base ^1.1
- flytachi/winter-cdo ^2.0
- flytachi/winter-edo-mapping ^1.0

Installation
------------

[](#installation)

```
composer require flytachi/winter-edo
```

---

Quick Start
-----------

[](#quick-start)

### 1. Define an entity

[](#1-define-an-entity)

```
use Flytachi\Winter\Edo\Entity\EntityInterface;

class UserEntity implements EntityInterface
{
    public int    $id;
    public string $name;
    public string $email;
    public string $status;

    public static function selection(): array
    {
        return [];  // use plain property names
    }
}
```

### 2. Define a repository

[](#2-define-a-repository)

```
use Flytachi\Winter\Edo\Stereotype\Repository;

class UserRepository extends Repository
{
    protected string $dbConfigClassName = DbConfig::class;
    protected string $entityClassName   = UserEntity::class;
    public static string $table         = 'users';
}
```

### 3. Read data

[](#3-read-data)

```
use Flytachi\Winter\Cdo\Qb;

// By primary key:
$user = UserRepository::findById(42);            // UserEntity|null

// With a condition:
$user = UserRepository::findBy(Qb::eq('email', 'alice@example.com'));

// All matching:
$users = UserRepository::findAllBy(Qb::eq('status', 'active'));

// Fluent query builder:
$users = UserRepository::instance('u')
    ->joinLeft('orders o', 'u.id = o.user_id')
    ->where(Qb::eq('u.status', 'active'))
    ->orderBy('u.name ASC')
    ->limit(20)
    ->findAll();

// Throw if not found:
$user = UserRepository::findByIdOrThrow(42, message: 'User not found');
```

### 4. Write data

[](#4-write-data)

```
$repo = new UserRepository();

// Insert:
$id = $repo->insert(['name' => 'Alice', 'email' => 'alice@example.com', 'status' => 'active']);

// Update:
$repo->update(['status' => 'inactive'], Qb::eq('id', $id));

// Delete:
$repo->delete(Qb::eq('id', $id));

// Upsert:
$repo->upsert(
    ['email' => 'alice@example.com', 'name' => 'Alice Updated'],
    ['email'],
    ['name' => ':new']
);
```

---

Stereotypes
-----------

[](#stereotypes)

ClassUse when`Repository`Need both reads and writes (most common)`RepositoryView`Read-only (views, reports, projections)`RepositoryCrud`Write-only (import pipelines, event sinks)`CteRepo`Ad-hoc query without a dedicated class```
// Ad-hoc:
use Flytachi\Winter\Edo\Stereotype\CteRepo;

$rows = (new CteRepo(DbConfig::class))
    ->from('audit_log al')
    ->joinLeft('users u', 'al.user_id = u.id')
    ->where(Qb::gt('al.created_at', '2024-01-01'))
    ->select('al.action, u.name, al.created_at')
    ->orderBy('al.created_at DESC')
    ->limit(100)
    ->findAll();
```

---

Query Builder — Method Reference
--------------------------------

[](#query-builder--method-reference)

### Clause order

[](#clause-order)

```
WITH [RECURSIVE] → SELECT → FROM → AS → JOIN → WHERE → GROUP BY → HAVING
→ UNION → ORDER BY → LIMIT / OFFSET → FOR

```

MethodSQL clauseNotes`with($name, $repo, $modifier)``WITH … AS (…)`CTE; chain for multiple`withRecursive($name, $repo)``WITH RECURSIVE … AS (…)`Recursive CTE`select($expr)``SELECT $expr`Overrides auto column list`from($source)``FROM …`String or repository subquery`as($alias)`table aliasAlso sets column prefix`join($repo, $on)``JOIN … ON(…)``joinInner($repo, $on)``INNER JOIN … ON(…)``joinLeft($repo, $on)``LEFT JOIN … ON(…)``joinRight($repo, $on)``RIGHT JOIN … ON(…)``joinCross($repo)``CROSS JOIN …`No ON condition`where($qb)``WHERE …`Accepts `null` (no-op)`andWhere($qb)``… AND …`Acts as `where()` if empty`orWhere($qb)``… OR …`Acts as `where()` if empty`xorWhere($qb)``… XOR …`Acts as `where()` if empty`groupBy($expr)``GROUP BY …``having($expr)``HAVING …``union($repo)``UNION …``unionAll($repo)``UNION ALL …``orderBy($expr)``ORDER BY …``limit($n, $offset)``LIMIT … OFFSET …`OFFSET omitted when 0`forBy($expr)``FOR …`Locking clause`binding($binds)`—Manual bind injection---

Documentation
-------------

[](#documentation)

Full documentation is in the [`docs/`](docs/) directory:

FileContents[00-overview.md](docs/00-overview.md)Architecture, quick start, doc index[01-stereotypes.md](docs/01-stereotypes.md)Choosing the right base class[02-configuration.md](docs/02-configuration.md)Properties, EntityInterface[03-select-from.md](docs/03-select-from.md)`select()`, `from()`, `as()`[04-joins.md](docs/04-joins.md)All JOIN types, subquery joins[05-where.md](docs/05-where.md)WHERE conditions[06-group-having.md](docs/06-group-having.md)`groupBy()`, `having()`[07-union.md](docs/07-union.md)`union()`, `unionAll()`[08-order-limit.md](docs/08-order-limit.md)`orderBy()`, `limit()`, `forBy()`[09-with-cte.md](docs/09-with-cte.md)CTEs, recursive queries[10-binds.md](docs/10-binds.md)Manual bind injection[11-sql-management.md](docs/11-sql-management.md)`buildSql()`, `getSql()`, `cleanCache()`[12-view-fetch.md](docs/12-view-fetch.md)`find`, `findAll`, `count`, `exists`, `rawFetch`[13-static-finders.md](docs/13-static-finders.md)Static finders and `*OrThrow` variants[14-crud.md](docs/14-crud.md)`insert`, `update`, `delete`, `upsert`[15-declaration.md](docs/15-declaration.md)Schema structure registry[16-advanced-examples.md](docs/16-advanced-examples.md)Real-world examples---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance84

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

19

Last Release

81d ago

Major Versions

v1.1.4 → v2.0.02026-04-07

v2.0.2 → v3.0.02026-04-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/861b81dd97c8ddfa919522d2a4e17626120bd3e3d7464857cc03784676bc74a8?d=identicon)[Flytachi](/maintainers/Flytachi)

---

Top Contributors

[![Flytachi](https://avatars.githubusercontent.com/u/68924300?v=4)](https://github.com/Flytachi "Flytachi (22 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/flytachi-winter-edo/health.svg)

```
[![Health](https://phpackages.com/badges/flytachi-winter-edo/health.svg)](https://phpackages.com/packages/flytachi-winter-edo)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
