PHPackages                             jmajors/jaysqlwrap - 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. jmajors/jaysqlwrap

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

jmajors/jaysqlwrap
==================

A basic PHP wrapper for SQL statements

0.0.3(9y ago)129MITPHPPHP &gt;=5.3.0

Since Apr 9Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (4)Used By (0)

Jay SQL Wrap
============

[](#jay-sql-wrap)

A simple PHP class for creating and executing basic SQL prepared statements as object methods. This provides an easy way to interact with a database while staying safe from SQL injection.

Installation with Composer
--------------------------

[](#installation-with-composer)

```
composer require jmajors/jaysqlwrap
```

See  for how to setup Composer.

Usage
-----

[](#usage)

Add composer's autoloader to your project:

```
require __DIR__ . '/vendor/autoload.php';
```

The wrapper will make a database connection upon instantiation using the database information in an application's .env file. If you don't have an .env file, you'll need to create one. See . Note that this has been included with the wrapper, you'll just need to create the .env file and load it in your application:

```
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
```

Create a Jaywrap instance:

```
$db = new Jaywrap\Jaywrap();
```

### INSERT

[](#insert)

The insert method has 2 parameters: The name of the table as a string, and an array of the data to be inserted. The keys for the data array need to match the column names of the table. For example:

```
$data = array('username' => 'jasonmajors', 'password' => 'somehashedpassword', 'age' => 28, 'language' => 'php');
$success = $db->insert('users', $data);
```

### SELECT

[](#select)

The select method has 2 parameters: The name of the table as a string, and an array of the WHERE conditions (optional).

Select all the items in a table:

```
$results = $db->select('sometable');
```

The results will be returned as an array.

```
print_r($results);

/*
 *	Array (
 *		[0] => Array (
 *				[columnX] => someValue
 *				[0] => someValue
 * 				[columnY] => someOtherValue
 *				[1] => someOtherValue
 *		)
 *		[1] => Array (
 *			 	[columnX] => someOtherValueTwo
 * 			 	[0] => someOtherValueTwo
 *			 	[columnY] => someOtherValueThree
 *			 	[1] => someOtherValueThree
 * 		)
 *	)
 */
```

#### SELECT with conditions:

[](#select-with-conditions)

```
$conditions = array('username' => 'jasonmajors', 'language' => 'php');
$results = $db->select('users', $conditions);
```

The above would execute a prepared statement of:

```
SELECT * FROM table WHERE username = 'jasonmajors' AND language = 'php';
```

You can also pass an array as a value in the conditions array:

```
$conditions = array('username' => array('jasonmajors', 'johndoe', 'janedoe'));
$results = $db->select('table', $conditions);
```

The above would execute:

```
SELECT * FROM table WHERE username IN ('jasonmajors', 'johndoe', 'janedoe');
```

### UPDATE

[](#update)

The update method has 3 parameters: The name of the table as a string, an array of the update data, and an array of the WHERE conditions.

```
$updates = array('language' => 'Python');
$conditions = array('username' => 'jasonmajors');
$success = $db->update('users', $updates, $conditions);
```

### DELETE

[](#delete)

The delete method has 2 parameters: The name of the table as a string, and an array of the WHERE conditions.

```
$delete = array('username' => 'jasonmajors');
$success = $db->delete('users', $updates, $conditions);
```

###  Health Score

24

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~8 days

Total

3

Last Release

3618d ago

### Community

Maintainers

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

---

Top Contributors

[![jasonmajors](https://avatars.githubusercontent.com/u/5776928?v=4)](https://github.com/jasonmajors "jasonmajors (28 commits)")

---

Tags

databasepdopdo-wrapperphpphpsqlwrapper

### Embed Badge

![Health badge](/badges/jmajors-jaysqlwrap/health.svg)

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

###  Alternatives

[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.8k](/packages/clouddueling-mysqldump-php)[stefangabos/zebra_database

An advanced, compact and lightweight MySQL database wrapper library, built around PHP's MySQLi extension.

11811.8k](/packages/stefangabos-zebra-database)[friedolinfoerder/wp-activerecord

An ActiveRecord implementation for WordPress

237.1k](/packages/friedolinfoerder-wp-activerecord)

PHPackages © 2026

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