PHPackages                             aalfiann/lazypdo - 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. aalfiann/lazypdo

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

aalfiann/lazypdo
================

A PHP class to make lazy load PDO connection to database.

1.0.1(7y ago)019MITPHPPHP &gt;=5.4

Since Apr 30Pushed 7y ago1 watchersCompare

[ Source](https://github.com/aalfiann/lazypdo)[ Packagist](https://packagist.org/packages/aalfiann/lazypdo)[ RSS](/packages/aalfiann-lazypdo/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

LazyPDO
=======

[](#lazypdo)

[![Latest Stable Version](https://camo.githubusercontent.com/7533b786545455550b3c39ab14408293bbbceb5a041c70f13e48b7654673884e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61616c6669616e6e2f6c617a7970646f2e737667)](https://packagist.org/packages/aalfiann/lazypdo)[![Total Downloads](https://camo.githubusercontent.com/081c41e25cf1e8116f5962aaae8b22af53a53b907fd140f0356367dd83574cc1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61616c6669616e6e2f6c617a7970646f2e737667)](https://packagist.org/packages/aalfiann/lazypdo)[![License](https://camo.githubusercontent.com/aa5e4860726aa4ad98ac084810cc432ee5464cc68e681635caa1261def8c9d24/68747470733a2f2f706f7365722e707567782e6f72672f61616c6669616e6e2f736974656d61702d6d616e616765722f6c6963656e7365)](https://github.com/aalfiann/lazypdo/blob/HEAD/LICENSE.md)

A PHP class to make lazy load PDO connection to database.
You can use LazyPDO to replace the default PDO, when you need to lazy load. No database connection will be made until first call to one of PDO's methods.

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

[](#installation)

Install this package via [Composer](https://getcomposer.org/).

```
composer install aalfiann/lazypdo

```

Usage
-----

[](#usage)

```
require 'vendor/autoload.php';
use aalfiann\LazyPDO;

$dsn = 'mysql:hostname=localhost;dbname=test';
$user = 'test';
$password = 'test';

$pdo = new LazyPDO($dns, $user, $password); // doesn't connect yet

$pdo->query('SELECT * FROM `table` WHERE 1'); // connection is made before executing query
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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

Total

2

Last Release

2568d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c101f6be505e4713be942f6b80d849b46702e6f4069430e1dbbe60fa18289c54?d=identicon)[aalfiann](/maintainers/aalfiann)

---

Tags

lazyloadlazypdopdopdolazyloadlazypdo

### Embed Badge

![Health badge](/badges/aalfiann-lazypdo/health.svg)

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

###  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)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.5M69](/packages/ifsnop-mysqldump-php)[nette/database

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5656.7M234](/packages/nette-database)[dibi/dibi

Dibi is Database Abstraction Library for PHP

5013.8M120](/packages/dibi-dibi)[aura/sql

A PDO extension that provides lazy connections, array quoting, query profiling, value binding, and convenience methods for common fetch styles. Because it extends PDO, existing code that uses PDO can use this without any changes to the existing code.

5632.5M43](/packages/aura-sql)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4572.9M34](/packages/aura-sqlquery)

PHPackages © 2026

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