PHPackages                             reflexive/core - 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. reflexive/core

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

reflexive/core
==============

Lazy PDO connection and some enums…

01.0k—0%PHP

Since Mar 1Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/RobinDumontChaponet/ReflexiveCore)[ Packagist](https://packagist.org/packages/reflexive/core)[ RSS](/packages/reflexive-core/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ReflexiveCore
=============

[](#reflexivecore)

$$ {{∀ x ∈ X : x R x}} $$

Shared building blocks for the Reflexive PHP packages.

This package contains:

- `Reflexive\Core\Database`: a lazy `PDO` wrapper that opens the connection on first real use.
- `Reflexive\Core\Condition` and `Reflexive\Core\ConditionGroup`: abstract condition primitives used by higher-level packages.
- `Reflexive\Core\Comparator` and `Reflexive\Core\Operator`: enums for SQL comparisons and boolean chaining.
- `Reflexive\Core\Strings::quote()`: a small helper that backticks SQL identifiers.

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

[](#requirements)

- PHP `^8.4`

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

[](#installation)

```
composer require reflexive/core
```

Lazy database connections
-------------------------

[](#lazy-database-connections)

`Database` extends `PDO`, but it does not call the parent constructor until you actually use the connection. That means you can pass a configured database object around without opening the socket immediately.

```
use Reflexive\Core\Database;

$db = new Database(
	'mysql:host=127.0.0.1;dbname=app;charset=utf8mb4',
	'user',
	'secret',
);

// No connection yet.
$stmt = $db->prepare('SELECT 1');
$stmt->execute();
```

The class also exposes `Database::once()` to keep one lazy instance per DSN:

```
$db = Database::once('sqlite:/tmp/app.sqlite');
```

Default PDO options applied on connect:

- `PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ`
- `PDO::ATTR_EMULATE_PREPARES => false`
- `PDO::ATTR_PERSISTENT => false`
- `PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION`

Conditions and operators
------------------------

[](#conditions-and-operators)

The abstract condition API is intentionally small and is meant to be subclassed by query layers.

```
use Reflexive\Core\Comparator;
use Reflexive\Core\Operator;
```

Available comparators:

- `EQUAL`
- `NOTEQUAL`
- `GREATER`
- `LESS`
- `GREATEROREQUAL`
- `LESSOREQUAL`
- `IN`
- `BETWEEN`
- `LIKE`
- `NULL`
- `NOTNULL`

Available boolean operators:

- `AND`
- `OR`

`ConditionGroup` enforces explicit chaining: once a condition has been added, the next one must be preceded by `and()` or `or()`.

Identifier quoting
------------------

[](#identifier-quoting)

`Strings::quote()` wraps bare identifiers in backticks while leaving SQL functions and already-quoted names alone.

```
use Reflexive\Core\Strings;

Strings::quote('users.email'); // `users`.`email`
Strings::quote('COUNT(*)');    // COUNT(*)
```

Scope
-----

[](#scope)

This package is mostly infrastructure. On its own it does not build SQL or hydrate models; those features live in:

- `reflexive/query`
- `reflexive/model`

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance56

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/34f6b38d1f65b58df4307dbdae9c274233181bb737b4098a817d85f19312b63a?d=identicon)[RobinDumontChaponet](/maintainers/RobinDumontChaponet)

---

Top Contributors

[![RobinDumontChaponet](https://avatars.githubusercontent.com/u/9157490?v=4)](https://github.com/RobinDumontChaponet "RobinDumontChaponet (27 commits)")

---

Tags

databasepdophp8work-in-progress

### Embed Badge

![Health badge](/badges/reflexive-core/health.svg)

```
[![Health](https://phpackages.com/badges/reflexive-core/health.svg)](https://phpackages.com/packages/reflexive-core)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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