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

ActiveLibrary

dczech/fluentpdo
================

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

1140PHP

Since Nov 15Pushed 12y ago1 watchersCompare

[ Source](https://github.com/dczech/fluentpdo)[ Packagist](https://packagist.org/packages/dczech/fluentpdo)[ RSS](/packages/dczech-fluentpdo/feed)WikiDiscussions pgsql Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

FluentPDO (pgsql)
=================

[](#fluentpdo-pgsql)

[![Build Status](https://camo.githubusercontent.com/5b751d184b5fe6ab49d12e456aebe14833205ddf872c4ae1c282cd7adb3c0853/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f64637a6563682f666c75656e7470646f2e706e673f6272616e63683d6d61737465722c706773716c)](http://travis-ci.org/dczech/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.1+ with any database supported by PDO

Install
-------

[](#install)

### Composer

[](#composer)

The preferred way to install FluentPDO is via [composer](http://getcomposer.org/).

Add in your `composer.json`:

```
"require": {
	...
	"dczech/fluentpdo": "dev-pgsql"
}

```

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=fblog", "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);
if ($user_id) {
    $query = $query
            ->where('user_id', $user_id)
            ->select('user.name');        // this join table user
}
foreach ($query as $row) {
    echo "$row[name] - $row[title]\n";
}
```

And executed query is:

```
SELECT article.*, user.name
FROM article
        LEFT JOIN user ON user.id = article.user_id
WHERE published_at > ? AND user_id = ?
ORDER BY published_at DESC
LIMIT 5
```

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

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

[](#simple-query-examples)

##### SELECT

[](#select)

```
$query = $fpdo->from('article')->orderBy('published_at DESC')->limit(5);
// or if you want to one row by primary key
$query = $fpdo->from('user', 2);
```

##### INSERT

[](#insert)

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

##### UPDATE

[](#update)

```
$set = array('published_at' => new FluentLiteral('NOW()'));
$query = $fpdo->update('article')->set($set)->where('id', 1);
// or shortly
$query = $fpdo->update('article', $set, 'id', 1);
```

##### DELETE

[](#delete)

```
$query = $fpdo->deleteFrom('article')->where('id', 1);
// or shortly
$query = $fpdo->deleteFrom('article', 'id', 1);
```

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

```
$fpdo->deleteFrom('article', 'id', 1)->execute();
```

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

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

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.6% 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/fb950e47bf5c924d00281eef182235819d7349753505fcbad97ccba83b5cedad?d=identicon)[dczech](/maintainers/dczech)

---

Top Contributors

[![dczech](https://avatars.githubusercontent.com/u/2190435?v=4)](https://github.com/dczech "dczech (25 commits)")[![jkufner](https://avatars.githubusercontent.com/u/16572?v=4)](https://github.com/jkufner "jkufner (6 commits)")[![cj-clx](https://avatars.githubusercontent.com/u/46033285?v=4)](https://github.com/cj-clx "cj-clx (4 commits)")[![mta59066](https://avatars.githubusercontent.com/u/936941?v=4)](https://github.com/mta59066 "mta59066 (1 commits)")[![pkoutsias](https://avatars.githubusercontent.com/u/5034122?v=4)](https://github.com/pkoutsias "pkoutsias (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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