PHPackages                             oktopost/squid - 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. oktopost/squid

ActiveLibrary

oktopost/squid
==============

MySQL library build on top of PDO

v2.0.1(2y ago)32.5k—0%13MITPHPPHP &gt;=8.1-stableCI passing

Since Jul 20Pushed 11mo ago16 watchersCompare

[ Source](https://github.com/Oktopost/Squid)[ Packagist](https://packagist.org/packages/oktopost/squid)[ Docs](https://github.com/Oktopost/Squid)[ RSS](/packages/oktopost-squid/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (7)Versions (39)Used By (3)

[![Build Status](https://camo.githubusercontent.com/fc5103ef54e9b761446189265acf3a1277afd0c09f4c7c6cd628ceb5d9d2c091/68747470733a2f2f7472617669732d63692e6f72672f4f6b746f706f73742f53717569642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Oktopost/Squid)

Squid
=====

[](#squid)

Squid is a MySQL library

Example code:

```
$select = $connector->select();
$select
	->column('a.*', 'b.Modified')
	->from('TableName', 'a')
	->leftJoin('AnotherTable', 'b', 'a.ID = b.TableNameID AND b.Status = ?', 'valid')
	->byField('b.Name', 'Jhon')
	->where('DATE(a.Created) > ?', new \DateTime());

$result = $select->query();

$modifiedAt = $result[0]['Modified'];
```

Basic Configuration
===================

[](#basic-configuration)

```
use Squid\MySql;

$mysql = new MySql();
$mysql->config()
	->addConfig(
	'connection_name',
	[
		'db'	=> 'db_name',
		'host'	=> 'localhost',
		'pass'	=> 'password',
		'user'	=> 'user_name'
	]);

// Aquire new connector object
$connector = $mysql->getConnector('connection_name');

// Aquiring commands
$select = $connector->select();
$insert = $connector->insert();
$delete = $connector->delete();
```

Select
======

[](#select)

Columns
-------

[](#columns)

### column method

[](#column-method)

```
public function column(...$columns)
```

Set the columns to select.

*Example:*

```
$select1->column('a', 'NOW()');
$select2->column('a.a', 'a.b');
```

Will result respectively in:

```
SELECT a, NOW()
SELECT a.a, a.b
```

### columns method

[](#columns-method)

```
public function columns($columns, $table = false)
```

Set the columns to select using an array variable.

*Example:*

```
$select1->columns(['a', 'NOW()']);
$select2->columns(['a', 'b'], 'a');
```

Will result respectively in:

```
SELECT a, NOW()
SELECT a.a, a.b
```

From
----

[](#from)

### from method

[](#from-method)

**NOTE:** A select can have only one main table. Calling this method a second time on the same select object will replace previous table selection.

```
public function from($table, $alias = false)
```

Describe the main table you want to select from. This method can't be used for selecting from multiplay tables. To do so, use the *join* method.

*Example:*

```
$select1->from('Table');
$select2->from('Table', 'a');
```

Will result respectively in:

```
SELECT * FROM Table
SELECT * FROM Table a
```

Where Clause
============

[](#where-clause)

The where clause commands are available in select, insert, update, upsert and delete commands.

where method
------------

[](#where-method)

```
public function where($exp, $bind = false)
```

Provide any costume where expression with optional bind parameters.

*Example:*

```
$select1->where('1 + 1 = ?', 2);
$select2->where('Table.SomeFieldName = ? - ?', [3, 1]);
$delete->where('NOW() > DATE(NOW())');
```

Will result respectively in:

```
SELECT * WHERE 1 + 1 = 2
SELECT * WHERE Table.SomeFieldName = 3 - 1
DELETE * WHERE NOW() > DATE(NOW())
```

byField method
--------------

[](#byfield-method)

```
public function byField($field, $value)
```

Search for field = value or, if value is an array, where field IN (values)

*Example:*

```
$select1->byField('Name', ['Jhon']);
$select1->byField('ROUND(Price)', [23]);
$select1->byField('ID', [2, 3]);
```

Will result respectively in:

```
SELECT * WHERE Name = 'Jhon'
SELECT * WHERE ROUND(Price) = 23
SELECT * WHERE ID IN (2, 3)
```

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 52.9% 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 ~89 days

Recently: every ~517 days

Total

37

Last Release

358d ago

Major Versions

1.2.0 → 2.0.02023-06-05

PHP version history (4 changes)1.0.0PHP &gt;=5.5-stable

1.0.20PHP &gt;=5.6-stable

1.0.23PHP &gt;=7.1-stable

2.0.0PHP &gt;=8.1-stable

### Community

Maintainers

![](https://www.gravatar.com/avatar/20dd11f9cfc13b0c4521787a143ea9ae3990e0458d712273fdf6c8a3529ca5d0?d=identicon)[alexey-pkv](/maintainers/alexey-pkv)

---

Top Contributors

[![alexey-pkv](https://avatars.githubusercontent.com/u/11766594?v=4)](https://github.com/alexey-pkv "alexey-pkv (82 commits)")[![grohman](https://avatars.githubusercontent.com/u/1030260?v=4)](https://github.com/grohman "grohman (41 commits)")[![ceres66](https://avatars.githubusercontent.com/u/16320669?v=4)](https://github.com/ceres66 "ceres66 (18 commits)")[![ivan-demchenkov](https://avatars.githubusercontent.com/u/7835992?v=4)](https://github.com/ivan-demchenkov "ivan-demchenkov (8 commits)")[![IssaMisherky](https://avatars.githubusercontent.com/u/102473502?v=4)](https://github.com/IssaMisherky "IssaMisherky (3 commits)")[![ivlev-ye](https://avatars.githubusercontent.com/u/34416957?v=4)](https://github.com/ivlev-ye "ivlev-ye (1 commits)")[![LaraKinan](https://avatars.githubusercontent.com/u/102249800?v=4)](https://github.com/LaraKinan "LaraKinan (1 commits)")[![liadgu](https://avatars.githubusercontent.com/u/1695651?v=4)](https://github.com/liadgu "liadgu (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oktopost-squid/health.svg)

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

PHPackages © 2026

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