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)1PHPPHP &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 3w ago

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

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

21

—

LowBetter than 18% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

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

3373d 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

[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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