PHPackages                             formal/access-layer - 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. formal/access-layer

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

formal/access-layer
===================

5.1.0(1mo ago)145.9k↓27%12MITPHPPHP ~8.4CI passing

Since Mar 7Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/formal-php/access-layer)[ Packagist](https://packagist.org/packages/formal/access-layer)[ Docs](http://github.com/formal-php/access-layer)[ RSS](/packages/formal-access-layer/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (14)Versions (32)Used By (2)

access-layer
============

[](#access-layer)

[![Build Status](https://github.com/formal-php/access-layer/workflows/CI/badge.svg?branch=master)](https://github.com/formal-php/access-layer/actions?query=workflow%3ACI)[![codecov](https://camo.githubusercontent.com/8456f9bc3d6a074c63590ac10c50b6bb0b6263ee18c28846242acba0fe8529a1/68747470733a2f2f636f6465636f762e696f2f67682f666f726d616c2d7068702f6163636573732d6c617965722f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/formal-php/access-layer)[![Type Coverage](https://camo.githubusercontent.com/7fe3b965d9ff2a0f0d7c69af906d89ec45d1dbe07955f3716a553e9dd54bba37/68747470733a2f2f73686570686572642e6465762f6769746875622f666f726d616c2d7068702f6163636573732d6c617965722f636f7665726167652e737667)](https://shepherd.dev/github/formal-php/access-layer)

This a simple abstraction layer on top of builtin `\PDO` class to offer a minimalist api.

The goal is separate expression of queries and their execution by using immutable structures and eliminating states wherever possible.

Important

you must use [`vimeo/psalm`](https://packagist.org/packages/vimeo/psalm) to make sure you use this library correctly.

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

[](#installation)

```
composer require formal/access-layer
```

Example
-------

[](#example)

```
use Formal\AccessLayer\{
    Connection\Lazy,
    Connection\PDO,
    Query\SQL,
    Row,
};
use Innmind\Url\Url;
use Innmind\Immutable\Sequence;

$connection = Lazy::of(static fn() => PDO::of(Url::of('mysql://user:pwd@127.0.0.1:3306/database_name')));

$rows = $connection(SQL::of('SELECT * FROM `some_table`'));
$rows; // instanceof Sequence
```

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

[](#documentation)

Complete documentation can be found at .

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance88

Actively maintained with recent releases

Popularity33

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 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 ~73 days

Recently: every ~154 days

Total

26

Last Release

58d ago

Major Versions

1.0.0 → 2.0.02022-03-06

2.17.0 → 3.0.02024-07-14

3.0.0 → 4.0.02024-07-14

4.2.0 → 5.0.02026-02-07

PHP version history (4 changes)1.0.0PHP ~8.0

2.0.0PHP ~8.1

2.2.0PHP ~8.2

5.0.0PHP ~8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (263 commits)")

---

Tags

connectiondatabase

### Embed Badge

![Health badge](/badges/formal-access-layer/health.svg)

```
[![Health](https://phpackages.com/badges/formal-access-layer/health.svg)](https://phpackages.com/packages/formal-access-layer)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[cycle/database

DBAL, schema introspection, migration and pagination

64690.9k31](/packages/cycle-database)[guikingone/scheduler-bundle

A Symfony bundle that allows to schedule and create repetitive tasks

114217.4k](/packages/guikingone-scheduler-bundle)[symfony/ai-store

Low-level abstraction for storing and retrieving documents in a vector store.

19292.4k53](/packages/symfony-ai-store)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[bartlett/php-compatinfo-db

Reference Database of all functions, constants, classes, interfaces on PHP standard distribution and about 110 extensions

1183.0k1](/packages/bartlett-php-compatinfo-db)

PHPackages © 2026

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