PHPackages                             molovo/interrogate - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. molovo/interrogate

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

molovo/interrogate
==================

v0.2.3(9y ago)1109[5 issues](https://github.com/molovo/interrogate/issues)PHPPHP &gt;=5.5

Since Jan 10Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (8)Used By (0)

Interrogate
===========

[](#interrogate)

Interrogate is a lightweight, standalone Object Relational Mapping (ORM) for PHP 5.5+.

Installing
----------

[](#installing)

```
composer require molovo/interrogate
```

Copy the included `.env.example` file from `vendor/molovo/interrogate` to your web server's `DOCUMENT_ROOT`, and rename it to `.env`. Then, update the new `.env` file with your database connection information.

Getting Started
---------------

[](#getting-started)

Queries are built using chained methods, which try to follow SQL grammar as much as possible. Queries return a `Collection` object containing multiple `Model` objects.

```
use Molovo\Interrogate\Database;
use Molovo\Interrogate\Query;

Database::bootstrap();

$query = Query::table('users')
    ->select('username', 'email')
    ->where('name', 'Joe Bloggs');

// @var $users Molovo\Interrogate\Collection
$users = $query->fetch();

// @var $user Molovo\Interrogate\Model
foreach ($users as $user) {
    echo $user->username;
    echo $user->email;
}
```

Using Joins
-----------

[](#using-joins)

Queries with joins can be built by passing another `Query` object to the `join()` method. The models returned by the joined query are stored in a property on the model, using the table name (or alias if defined). The joined query can compare fields on the parent query with dot syntax, using either the table name (or alias) directly, or the keyword `parent` as below.

```
use Molovo\Interrogate\Query;

$query = Query::table('users_table', 'users')
    ->select('name')
    ->join(Query::table('addresses_table', 'addresses')
        ->select('town')
        ->on('user_id', 'parent.id'));

$users = $query->fetch();

foreach ($users as $user) {
    // @var $addresses Molovo\Interrogate\Collection
    $addresses = $user->addresses;

    foreach ($addresses as $address) {
        echo $address->town;
    }
}
```

Using Models
------------

[](#using-models)

Model classes can created for tables to allow for quick query creation, and adding functionality on a per-table basis. The simplest form of a model is shown below:

```
namespace Models;

use Molovo\Interrogate\Model;

class User extends Model {}
```

By default, the table name is the pluralized snake\_cased equivalent of the class name. E.g. the model `UserDetail` refers to a table `user_details`. To use a different table name, define the static property `$tableName`.

```
class User extends Model {
    protected static $tableName = 'the_users_table';
}
```

Models make use of magic methods to allow static access to methods in the Query class.

```
$user = User::where('name', 'Joe Bloggs');

// is equivalent to

$user = Query::table('users')->where('name', 'Joe Bloggs');
```

You can also statically call methods on the `Collection` class.

```
$names = User::toList('name');

// is equivalent to

$collection = Query::table('users')->fetch();
$names = $collection->toList('name');
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Recently: every ~111 days

Total

6

Last Release

3328d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/790a48c33c76e344f6eab8edd15abca37ad75d2a957e744347b5ac4acecd9ec6?d=identicon)[molovo](/maintainers/molovo)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/molovo-interrogate/health.svg)

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

###  Alternatives

[symfony/stopwatch

Provides a way to profile code

2.8k387.2M915](/packages/symfony-stopwatch)[spatie/ignition

A beautiful error page for PHP applications.

510147.6M69](/packages/spatie-ignition)[clawrock/magento2-debug

Magento 2 debug module based on Magento 1 Profiler with some extra features.

8419.3k1](/packages/clawrock-magento2-debug)

PHPackages © 2026

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