PHPackages                             jublonet/monty - 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. jublonet/monty

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

jublonet/monty
==============

A simple MySQL/MariaDB database wrapper in PHP.

2.4.2(8y ago)129[3 issues](https://github.com/jublo/monty/issues)LGPL-3.0+PHP

Since Jun 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/jublo/monty)[ Packagist](https://packagist.org/packages/jublonet/monty)[ RSS](/packages/jublonet-monty/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)DependenciesVersions (10)Used By (0)

monty
=====

[](#monty)

*A simple MySQL/MariaDB database wrapper in PHP.*

Copyright (C) 2011-2017 Jublo Solutions

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see .

### Requirements

[](#requirements)

- PHP 5.5.0 or higher

First steps
-----------

[](#first-steps)

```
// load monty
require 'monty/loader.php';

// get the MySQL connector
$connector = Monty::getConnector();

// connect to a database
$connector->open('youruser', 'fancypass', 'holydatabase');

// not running the database on localhost? add a 4th parameter like this:
// $db->open('youruser', 'fancypass', 'holydatabase', 'pentagon.example.com');

// need a custom port number? add a 5th parameter like this:
// $db->open(
//   'youruser', 'fancypass', 'holydatabase',
//   'pentagon.example.com', 3307
// );

// want a persistent connection? add a 6th parameter like this:
// $db->open(
//   'youruser', 'fancypass', 'holydatabase',
//   'pentagon.example.com', 3307, MONTY_OPEN_PERSISTENT
// );

// now there's two operation modes:
// the EASY one first
$table = $connector->table('themaintable');

// want multiple tables?
// $table->add('anothertable');

// set a condition
$table->where('field', '=', 'value');

// there are some shortcuts, like this one:
// $table->eq('field', 'value');

// switching to DISTINCT results is possible, too:
// $table->select(MONTY_SELECT_DISTINCT);

// you might also want to use ands/ors
// $table->or(
//   $table->eq('field1', 'value1'),
//   $table->like('field2', 'value2')
// );
// equals:
// ... WHERE field1 = "value1" OR field2 LIKE "value2"

// peek at the generated sql code without executing it
echo $table->sql() . '';

// loop through the results and display them
for($i = 0; $i < $table->rows(); $i++) {
  $row_array = $table->next();
  echo $row_array['field'] . ' = ' . $row_array['value'] . '';
}

// you could also have got an object instead, like this:
// $row = $table->next(MONTY_NEXT_OBJECT);
// echo $row->field;

// for setting the object return type as default, put this statement
// at the top of your code:
// $table->setReturnType(MONTY_ALL_OBJECT);

// you can also run raw SQL like this (the nerd mode):
$connector->query('SELECT * FROM themaintable WHERE field = "value"');
echo $connector->rows();

// check if a certain table exists at the moment:
if ($connector->tableExists('the_table')) {
  // do something
}

// update values
$values = [
  'column1' => 'Test',
  'column2' => 12345
];
$table->update($values);

// update a single value
$table->update('column1', 'Test');

// update by using the content of another field
// like: SET column2 = column1
$table->update('column2', ['column1']); // note the array syntax for value
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity69

Established project with proven stability

 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 ~221 days

Recently: every ~378 days

Total

8

Last Release

3153d ago

### Community

Maintainers

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

---

Top Contributors

[![mynetx](https://avatars.githubusercontent.com/u/6348321?v=4)](https://github.com/mynetx "mynetx (128 commits)")

---

Tags

mariadbmysqlmysql-databasephp

### Embed Badge

![Health badge](/badges/jublonet-monty/health.svg)

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

###  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)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

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

Reliese Components for Laravel Framework code generation.

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

PHPackages © 2026

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