PHPackages                             samuelfaj/class\_db - 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. samuelfaj/class\_db

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

samuelfaj/class\_db
===================

Class DB allows you to write secure SQL queries easily and work with many different databases using the same syntax.

2.1.0(8y ago)228[1 issues](https://github.com/samuelfaj/PHP-class_db.php/issues)MITPHPPHP &gt;=5.3.0

Since Mar 4Pushed 7y ago2 watchersCompare

[ Source](https://github.com/samuelfaj/PHP-class_db.php)[ Packagist](https://packagist.org/packages/samuelfaj/class_db)[ RSS](/packages/samuelfaj-class-db/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (5)Used By (0)

Class\_DB
=========

[](#class_db)

[![](https://camo.githubusercontent.com/bb23b9af511999b9a04647e88bc985c2910f91f49365a77d4f2587e109774ddf/68747470733a2f2f7777772e6973736172742e636f6d2f626c6f672f77702d636f6e74656e742f75706c6f6164732f323031372f30332f626f78626172696d616765352e6a7067)](https://camo.githubusercontent.com/bb23b9af511999b9a04647e88bc985c2910f91f49365a77d4f2587e109774ddf/68747470733a2f2f7777772e6973736172742e636f6d2f626c6f672f77702d636f6e74656e742f75706c6f6164732f323031372f30332f626f78626172696d616765352e6a7067)

[![MIT license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)[![built with PHP](https://camo.githubusercontent.com/d9c977f75c124e2aa437e3855b7bde8b2094f74fc340ef4637fa2c684a81b962/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c74253230776974682d5048502d7265642e737667)](https://www.php.net/)[![MySQL Ready](https://camo.githubusercontent.com/d01bfeff55b5fd286a67f0b2e2a83271886fcf52df12725aac8521065a88573b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7973716c2d72656164792d677265656e2e737667)](https://camo.githubusercontent.com/d01bfeff55b5fd286a67f0b2e2a83271886fcf52df12725aac8521065a88573b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7973716c2d72656164792d677265656e2e737667)[![MySQLI Ready](https://camo.githubusercontent.com/eb3ce16e6d1ea182a5b114b58d3c94b241102365150b6e2c792c15f697a8a2a8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7973716c692d72656164792d677265656e2e737667)](https://camo.githubusercontent.com/eb3ce16e6d1ea182a5b114b58d3c94b241102365150b6e2c792c15f697a8a2a8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7973716c692d72656164792d677265656e2e737667)[![mssql Ready](https://camo.githubusercontent.com/1c41da2ee0affa1078e17f07a189373d1e194d545428070f195c4eb9017e0575/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7373716c2d72656164792d677265656e2e737667)](https://camo.githubusercontent.com/1c41da2ee0affa1078e17f07a189373d1e194d545428070f195c4eb9017e0575/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7373716c2d72656164792d677265656e2e737667)[![sqlserv Ready](https://camo.githubusercontent.com/42600ae377886bde8b331a751a564bf2dbe2a7ad80e5b544c40b24bb2c4e2fd3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73716c736572762d72656164792d677265656e2e737667)](https://camo.githubusercontent.com/42600ae377886bde8b331a751a564bf2dbe2a7ad80e5b544c40b24bb2c4e2fd3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73716c736572762d72656164792d677265656e2e737667)[![pgsql Ready](https://camo.githubusercontent.com/df5449db41db55d932b6bfd1251a8ad3811638a63c23ded716664a70db293295/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706773716c2d72656164792d677265656e2e737667)](https://camo.githubusercontent.com/df5449db41db55d932b6bfd1251a8ad3811638a63c23ded716664a70db293295/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706773716c2d72656164792d677265656e2e737667)

*Write less. Do a lot more.***Class\_DB allows you to write secure SQL queris easily and work with many different databases using the same syntax**

Everytime i was working with or starting a new system, i had to look at the database documentation and choose between create a class for it using mine functions or write the system following his own. But what if the driver changed? Yeah, Everyone who is here for a while saw some changes in PHP drivers. Those changes were a painful work for great systems and even more for small teams. We saw mssql become sqlserv, mysql become mysqli and it's common to see groups deciding to change the database in the middle of the project.

Thinking about it i developed class\_db. It helps us to write less SQL and don't care for the chosen database. Just write your code and class\_db will do the rest. If the driver or the team resolves to change, just update it!

### Install

[](#install)

It's simple, just download and require it.

```
composer require samuelfaj/class_db
```

Examples
--------

[](#examples)

Initializing

```
