PHPackages                             qikdev/fluentpdo - 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. qikdev/fluentpdo

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

qikdev/fluentpdo
================

FluentPDO is small PHP library for rapid query building. Killer feature is smart join builder which generates joins automatically.

1.2.6(7y ago)198812Apache-2.0PHP

Since Feb 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/QikDev/fluentpdo)[ Packagist](https://packagist.org/packages/qikdev/fluentpdo)[ Docs](https://github.com/qikdev/fluentpdo)[ RSS](/packages/qikdev-fluentpdo/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (8)DependenciesVersions (16)Used By (2)

FluentPDO [![Build Status](https://camo.githubusercontent.com/b64412308e1025f5d34685862b53c06ae00fa624e7a41b2e81b6846957fe8162/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f656e766d732f666c75656e7470646f2e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/envms/fluentpdo) [![Code Climate](https://camo.githubusercontent.com/aee570932748fcdf687d31f4cc2140cf968b858ff537fc14ad05eb04fa07f7b2/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6670646f2f666c75656e7470646f2f6261646765732f6770612e737667)](https://codeclimate.com/github/fpdo/fluentpdo)
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#fluentpdo--)

FluentPDO - smart SQL builder for PHP.

FluentPDO is small PHP library for rapid query building. Killer feature is "Smart join builder" which generates joins automatically.

Features
--------

[](#features)

- Fluent interface for creating queries step by step
- Smart join builder
- Simple API based on PDO and SQL syntax
- Build SELECT, INSERT, UPDATE &amp; DELETE queries
- Small and fast
- Type hinting with code completion in smart IDEs
- Requires PHP 5.3+ with any database supported by PDO

Reference
---------

[](#reference)

[Sitepoint - Getting Started with FluentPDO](http://www.sitepoint.com/getting-started-fluentpdo/)

Install
-------

[](#install)

### Composer

[](#composer)

The preferred way to install FluentPDO is via [composer](http://getcomposer.org/). v1.1.x will be the last until the release of 2.0, so we recommend using 1.1.\* to ensure no breaking changes are introduced.

Add in your `composer.json`:

```
"require": {
	...
	"fpdo/fluentpdo": "1.1.*"
}

```

then update your dependencies with `composer update`.

### Copy

[](#copy)

If you are not familiar with composer just copy `/FluentPDO` directory into your `libs/` directory then:

```
include "libs/FluentPDO/FluentPDO.php";
```

Start usage
-----------

[](#start-usage)

```
$pdo = new PDO("mysql:dbname=fluentdb", "root");
$fpdo = new FluentPDO($pdo);
```

First example
-------------

[](#first-example)

FluentPDO is easy to use:

```
$query = $fpdo->from('article')
            ->where('published_at > ?', $date)
            ->orderBy('published_at DESC')
            ->limit(5);
foreach ($query as $row) {
    echo "$row[title]\n";
}
```

executed query is:

```
SELECT article.*
FROM article
WHERE published_at > ?
ORDER BY published_at DESC
LIMIT 5
```

Smart join builder (how to build queries)
-----------------------------------------

[](#smart-join-builder-how-to-build-queries)

If you want to join table you can use full sql join syntax. For example we would like to show list of articles with author name:

```
$query = $fpdo->from('article')
              ->leftJoin('user ON user.id = article.user_id')
              ->select('user.name');
```

It was not so much smart, was it? ;-) If your database uses convention for primary and foreign key names, you can write only:

```
$query = $fpdo->from('article')->leftJoin('user')->select('user.name');
```

Smarter? May be. but **best practice how to write joins is not to write any joins ;-)**

```
$query = $fpdo->from('article')->select('user.name');
```

All three commands create same query:

```
SELECT article.*, user.name
FROM article
LEFT JOIN user ON user.id = article.user_id
```

Simple CRUD Query Examples
--------------------------

[](#simple-crud-query-examples)

##### SELECT

[](#select)

```
$query = $fpdo->from('article')->where('id', 1);
// or shortly if you select one row by primary key
$query = $fpdo->from('user', 1);
```

##### INSERT

[](#insert)

```
$values = array('title' => 'article 1', 'content' => 'content 1');
$query = $fpdo->insertInto('article')->values($values)->execute();
// or shortly
$query = $fpdo->insertInto('article', $values)->execute();
```

##### UPDATE

[](#update)

```
$set = array('published_at' => new FluentLiteral('NOW()'));
$query = $fpdo->update('article')->set($set)->where('id', 1)->execute();
// or shortly if you update one row by primary key
$query = $fpdo->update('article', $set, 1)->execute();
```

##### DELETE

[](#delete)

```
$query = $fpdo->deleteFrom('article')->where('id', 1)->execute();
// or shortly if you delete one row by primary key
$query = $fpdo->deleteFrom('article', 1)->execute();
```

*Note: INSERT, UPDATE and DELETE will be executed after `->execute()`:*

Full documentation can be found on the [FluentPDO homepage](http://fpdo.github.io/fluentpdo/)

Licence
-------

[](#licence)

Free for commercial and non-commercial use ([Apache License](http://www.apache.org/licenses/LICENSE-2.0.html) or [GPL](http://www.gnu.org/licenses/gpl-2.0.html)).

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~159 days

Total

10

Last Release

2631d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2428ebf4503e38e03ba8c89ed600adeeaf2c2812e1bc2e80336fcd181d86462f?d=identicon)[qikdev](/maintainers/qikdev)

---

Top Contributors

[![mistevs](https://avatars.githubusercontent.com/u/25775429?v=4)](https://github.com/mistevs "mistevs (37 commits)")[![maldoinc](https://avatars.githubusercontent.com/u/1253062?v=4)](https://github.com/maldoinc "maldoinc (17 commits)")[![cbornhoft](https://avatars.githubusercontent.com/u/10536543?v=4)](https://github.com/cbornhoft "cbornhoft (15 commits)")[![jkufner](https://avatars.githubusercontent.com/u/16572?v=4)](https://github.com/jkufner "jkufner (6 commits)")[![StefanYohansson](https://avatars.githubusercontent.com/u/1783252?v=4)](https://github.com/StefanYohansson "StefanYohansson (6 commits)")[![cj-clx](https://avatars.githubusercontent.com/u/46033285?v=4)](https://github.com/cj-clx "cj-clx (4 commits)")[![maratK13](https://avatars.githubusercontent.com/u/3388197?v=4)](https://github.com/maratK13 "maratK13 (2 commits)")[![dczech](https://avatars.githubusercontent.com/u/2190435?v=4)](https://github.com/dczech "dczech (2 commits)")[![pkoutsias](https://avatars.githubusercontent.com/u/5034122?v=4)](https://github.com/pkoutsias "pkoutsias (1 commits)")[![rivulent](https://avatars.githubusercontent.com/u/1018042?v=4)](https://github.com/rivulent "rivulent (1 commits)")[![Alpine418](https://avatars.githubusercontent.com/u/4191615?v=4)](https://github.com/Alpine418 "Alpine418 (1 commits)")[![tmihalik](https://avatars.githubusercontent.com/u/440762?v=4)](https://github.com/tmihalik "tmihalik (1 commits)")[![BenLorantfy](https://avatars.githubusercontent.com/u/4398635?v=4)](https://github.com/BenLorantfy "BenLorantfy (1 commits)")[![gsouf](https://avatars.githubusercontent.com/u/3215399?v=4)](https://github.com/gsouf "gsouf (1 commits)")[![jay-knight](https://avatars.githubusercontent.com/u/42975397?v=4)](https://github.com/jay-knight "jay-knight (1 commits)")[![jk3us](https://avatars.githubusercontent.com/u/41621?v=4)](https://github.com/jk3us "jk3us (1 commits)")[![joy2fun](https://avatars.githubusercontent.com/u/7264066?v=4)](https://github.com/joy2fun "joy2fun (1 commits)")[![Kaile](https://avatars.githubusercontent.com/u/5454122?v=4)](https://github.com/Kaile "Kaile (1 commits)")[![mta59066](https://avatars.githubusercontent.com/u/936941?v=4)](https://github.com/mta59066 "mta59066 (1 commits)")

---

Tags

databasedbalpdo

### Embed Badge

![Health badge](/badges/qikdev-fluentpdo/health.svg)

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

###  Alternatives

[doctrine/dbal

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

9.7k595.8M6.5k](/packages/doctrine-dbal)[dibi/dibi

Dibi is Database Abstraction Library for PHP

5013.9M129](/packages/dibi-dibi)[envms/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

923530.0k13](/packages/envms-fluentpdo)[lichtner/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

920281.8k6](/packages/lichtner-fluentpdo)[fpdo/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

920249.3k8](/packages/fpdo-fluentpdo)[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.

816.0k](/packages/tommyknocker-pdo-database-class)

PHPackages © 2026

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