PHPackages                             yorch/mydb - 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. yorch/mydb

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

yorch/mydb
==========

Abstract Class to manage RDBMS (MySQL, MSSQLServer, ODBC, PostgreSQL) connections

0112PHP

Since Oct 12Pushed 8y ago2 watchersCompare

[ Source](https://github.com/yorch81/MyDb)[ Packagist](https://packagist.org/packages/yorch/mydb)[ RSS](/packages/yorch-mydb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

MyDb
====

[](#mydb)

Description
-----------

[](#description)

Abstract Class to manage RDBMS (MySQL, MSSQLServer, ODBC, PostgreSQL) connections

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

[](#requirements)

- [PHP 5.4.1 or higher](http://www.php.net/)
- [mysqli extension](http://php.net/manual/en/class.mysqli.php)
- [sqlsrv extension](http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx/)
- [odbc extension](http://php.net/manual/en/ref.uodbc.php)
- [pgsql extension](http://php.net/manual/en/ref.pgsql.php)
- [monolog](https://github.com/Seldaek/monolog)

Developer Documentation
-----------------------

[](#developer-documentation)

Execute phpdoc -d MyDb/

Installation
------------

[](#installation)

Create file composer.json

{ "require": { "yorch/mydb": "dev-master" } }

Execute composer.phar install

Example
-------

[](#example)

```
// Mysql Example
$provider = 'MySQLDb';
$hostname = '';
$username = '';
$password = '';
$dbname   = '';

$dbMySQL = MyDb::getInstance($provider, $hostname, $username, $password, $dbname, 3306);

$query = sprintf("SELECT 1 AS %s", $dbMySQL->escape($provider));

// Associate
print_r($dbMySQL->executeCommand($query));

// Enumerate
print_r($dbMySQL->executeCommand($query, null, MyDb::ENUM));

$dbMySQL = null;

```

Notes
-----

[](#notes)

The SQL Server connection only works in MS Windows.

For PostgreSQL the parameters in SQL Query must be $#. example: 'SELECT \* FROM MYTABLE WHERE ID = $1 AND DESCRIPTION = $2'

For ODBC connection, if the query insert uses ? parameters throw this error (COUNT field incorrect or syntax error).

Sorry, my english is bad :(.

References
----------

[](#references)

[http://es.wikipedia.org/wiki/Patr%C3%B3n\_de\_dise%C3%B1o](http://es.wikipedia.org/wiki/Patr%C3%B3n_de_dise%C3%B1o)

[http://es.wikipedia.org/wiki/Abstract\_Factory](http://es.wikipedia.org/wiki/Abstract_Factory)

Donate
------

[](#donate)

[![Donate](https://camo.githubusercontent.com/604e3db9c8751116b3f765aad0353ec7ded655bbe8aaacbc38d8c4a6b784b3ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d677265656e2e737667)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GXT4C7UZ3HFA8)

P.D. Let's go play !!!

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![yorch81](https://avatars.githubusercontent.com/u/4605324?v=4)](https://github.com/yorch81 "yorch81 (38 commits)")

### Embed Badge

![Health badge](/badges/yorch-mydb/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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