PHPackages                             lucite/model - 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. lucite/model

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

lucite/model
============

v0.0.7(1y ago)0161MITPHP

Since Sep 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/octoth0rpe/LuciteModel)[ Packagist](https://packagist.org/packages/lucite/model)[ RSS](/packages/lucite-model/feed)WikiDiscussions main Synced yesterday

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

lucite/model
============

[](#lucitemodel)

A simple data fetching layer that uses PDO.

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

[](#installation)

`composer require lucite/model`

Usage
-----

[](#usage)

A model defines 5 methods:

- -&gt;fetchOne(int|string $id): array
- -&gt;fetchMany(): array
- -&gt;create(array $data): array
- -&gt;update(int|string $id, array $data): array
- -&gt;delete(int|string $id): void

To create a model, implement a class that extends `Lucite\Model\Model` and define 3 static attributes:

- public static string $tableName # the name of the table to use
- public static string $primaryKey # the name of the table's primary key (compound primary keys are not yet supported)
- public static array $columns # the table's columns, excluding the primary key.

You must also define two methods that are used to apply permissions:

- public function applyPermissionValues(array &amp;$data): void
- public function getPermissionFilter(array &amp;$args): string

If the table in question will never have any permissions enforced, you can use Lucite\\Model\\NoPermissionCheckTrait to add dummy implementations of these methods.

Instantiating a model
---------------------

[](#instantiating-a-model)

The model's constructor requires two parameters:

- PDO $db
- Psr\\Log\\LoggerInterface $logger

You may want to look at lucite/mocklogger for a simple psr-3 logger that can be used for unit testing

Debugging
---------

[](#debugging)

Every time a model runs a query (which might be multiple times per method), two messages are logged using the -&gt;debug method of the logger passed to the model constructor:

- The query, including placeholders (eg, `SELECT id FROM table WHERE id=:id`)
- The args passed to the PDO::Statement -&gt;execute function (eg, `["id" => 4]`)

Implementing permissions
------------------------

[](#implementing-permissions)

Details coming soon, but there is a simple example in `src/Tests/ModelWithPermissionsTest.php`;

Future features
---------------

[](#future-features)

### Add support for 4 parameters to fetchMany

[](#add-support-for-4-parameters-to-fetchmany)

- `int $page`
- `int $pageSize`
- `string $sortColumn`
- `array $filters` (format tbd)

### Support for multicolumn filtering

[](#support-for-multicolumn-filtering)

Details tbd.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

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

Total

7

Last Release

647d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31517771?v=4)[octoth0rpe](/maintainers/octoth0rpe)[@octoth0rpe](https://github.com/octoth0rpe)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/lucite-model/health.svg)

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[mimmi20/browser-detector

Library to detect Browsers and Devices

48157.5k5](/packages/mimmi20-browser-detector)

PHPackages © 2026

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