PHPackages                             rcastera/mysql-wrapper - 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. rcastera/mysql-wrapper

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

rcastera/mysql-wrapper
======================

MySQL Abstraction Class

v1.0.1(12y ago)6444MITPHPPHP &gt;=5.3.0

Since Sep 28Pushed 12y ago1 watchersCompare

[ Source](https://github.com/rcastera/MySQL-Wrapper-Class)[ Packagist](https://packagist.org/packages/rcastera/mysql-wrapper)[ Docs](http://www.richardcastera.com)[ RSS](/packages/rcastera-mysql-wrapper/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (3)Used By (0)

MySQL Abstraction Class
=======================

[](#mysql-abstraction-class)

This is a class that I've used in some of my projects for years. It's a simple wrapper to MySQL written in PHP5 that allows you to connect, run queries and get results. It's been used in production sites for some time now and I've re-factored it several times.

### Setup

[](#setup)

---

Add a `composer.json` file to your project:

```
{
  "require": {
      "rcastera/mysql-wrapper": "v1.0.0"
  }
}
```

Then provided you have [composer](http://getcomposer.org) installed, you can run the following command:

```
$ composer.phar install
```

That will fetch the library and its dependencies inside your vendor folder. Then you can add the following to your .php files in order to use the library (if you don't already have one).

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

Then you need to `use` the relevant class, and instantiate the class. For example:

### Getting Started

[](#getting-started)

---

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

use rcastera\Database\Mysql\Mysql;

$db = new Mysql('localhost', 'DATABASE', 'USERNAME', 'PASSWORD');
```

### Examples

[](#examples)

---

##### Select all records from contacts table.

[](#select-all-records-from-contacts-table)

```
