PHPackages                             venar/select - 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. venar/select

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

venar/select
============

PHP Class to build queries for MySQL. Allows you to build chains of conditions. The goal of this class is to encapsulate PHP's interactions with MySQL to reduce errors in writing queries and make creating stored procedures simple.

2.1.2(11y ago)0142PHPPHP &gt;=5.5.0

Since Jul 8Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Venar/select)[ Packagist](https://packagist.org/packages/venar/select)[ RSS](/packages/venar-select/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Select MySQL Class for PHP
==========================

[](#select-mysql-class-for-php)

PHP Class to build queries for MySQL. Allows you to build chains of conditions. The goal of this class is to encapsulate PHP's interactions with MySQL to reduce errors in writing queries and make creating stored procedures simple.

Requirements
------------

[](#requirements)

This project requires PHP 5.5+ and MySQL

### Documentation

[](#documentation)

[Getting Started: Examples and Documentation](docs/GETTING_STARTED.md)

### functions

[](#functions)

#### -&gt;getInsertId()

[](#-getinsertid)

Gets the Last Insert ID after you insert a row

### Comparison List

[](#comparison-list)

#### -&gt;eq(field, value)

[](#-eqfield-value)

Compare the field to the value

#### -&gt;notEq(field, value)

[](#-noteqfield-value)

Compare the field to the value and make sure it does not match

#### -&gt;eqConditional(field, value)

[](#-eqconditionalfield-value)

Compare the value to the value. If the value is an empty string, then this comparison will be dropped from the query silently

#### -&gt;eqNull(field)

[](#-eqnullfield)

Compare the field to NULL

#### -&gt;eqNotNull(field)

[](#-eqnotnullfield)

Compare the field to NOT NULL

#### -&gt;eqRequired(field, value)

[](#-eqrequiredfield-value)

Compare the field to the value. If the value is an empty string, then this will force an 1 = 0 in the query and cause the query to return no rows

#### -&gt;gt(field, value)

[](#-gtfield-value)

If the value greater than the field

#### -&gt;gte(field, value)

[](#-gtefield-value)

If the value greater than the field or equal to the field

#### -&gt;in(field, value)

[](#-infield-value)

Performs an IN clause, value can be String\[\], Subquery SQL, or another Select Class object

#### -&gt;notIn(field, value)

[](#-notinfield-value)

Inverse of in(). Performs an NOT IN clause, value can be String\[\], Subquery SQL, or another Select Class object

#### -&gt;like(field, value)

[](#-likefield-value)

Wildcard search to see if the value is in the string. Defaults to adding left and right wildcard, only if % is not present in the value

#### -&gt;lt(field, value)

[](#-ltfield-value)

If the value less than the field

#### -&gt;lte(field, value)

[](#-ltefield-value)

If the value less than the field or equal to the field

### Conjunction Groups

[](#conjunction-groups)

#### -&gt;startOr()

[](#-startor)

Begins an Or() condition grouping. All comparison after this are joined using OR rather than AND. All wrapped in parenthese

#### -&gt;endOr()

[](#-endor)

Ends a startOr() condition grouping

#### -&gt;startAnd()

[](#-startand)

Default Grouping, only needed if inside of an Or() grouping. Begins an And() condition grouping. All comparison after this are joined using OR rather than AND. All wrapped in parenthese

#### -&gt;endAnd()

[](#-endand)

Ends a startAnd() condition grouping. Cannot end the outer most grouping.

### Sorting &amp; Grouping

[](#sorting--grouping)

#### -&gt;group()

[](#-group)

The GROUP BY value e.g. 'Date DESC' or 'LastName ASC, FirstName ASC'

#### -&gt;order(value)

[](#-ordervalue)

The ORDER BY value e.g. 'LastName' or 'LastName, FirstName'

#### -&gt;offset(value)

[](#-offsetvalue)

The Integer to offset the results by

#### -&gt;limit(value)

[](#-limitvalue)

The number of results to limit the return to

###  Health Score

26

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% 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 ~1 days

Total

2

Last Release

4056d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3811856?v=4)[John J. Koniges](/maintainers/Venar)[@Venar](https://github.com/Venar)

---

Top Contributors

[![Venar](https://avatars.githubusercontent.com/u/3811856?v=4)](https://github.com/Venar "Venar (17 commits)")[![sethbattin](https://avatars.githubusercontent.com/u/1627760?v=4)](https://github.com/sethbattin "sethbattin (1 commits)")

### Embed Badge

![Health badge](/badges/venar-select/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.8k117.8M121](/packages/jdorn-sql-formatter)[backup-manager/backup-manager

A framework agnostic database backup manager with user-definable procedures and support for S3, Dropbox, FTP, SFTP, and more with drivers for popular frameworks.

1.7k1.6M11](/packages/backup-manager-backup-manager)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M88](/packages/propel-propel1)[insolita/yii2-migration-generator

Set of gii tools for generating files for migration by schema of table , phpdoc or table data

108508.0k5](/packages/insolita-yii2-migration-generator)[xpdo/xpdo

A PDO-based Object/Relational Bridge Library

7088.4k4](/packages/xpdo-xpdo)[voku/session2db

A PHP library acting as a wrapper for PHP's default session handling functions which stores data in a MySQL database, providing both better performance and better security and protection against session fixation and session hijacking.

2920.0k](/packages/voku-session2db)

PHPackages © 2026

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