PHPackages                             ksfraser/genericinterface - 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. ksfraser/genericinterface

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

ksfraser/genericinterface
=========================

Generic interface trait for database models, with validation hooks.

0.6.0(3mo ago)0151MITPHP

Since Feb 19Pushed 3mo agoCompare

[ Source](https://github.com/ksfraser/GenericInterface)[ Packagist](https://packagist.org/packages/ksfraser/genericinterface)[ RSS](/packages/ksfraser-genericinterface/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (7)Used By (1)

Ksfraser\\GenericInterface
==========================

[](#ksfrasergenericinterface)

A reusable trait for database model classes, providing standardized property access, mutation, and validation hooks.

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

[](#installation)

```
composer require ksfraser/genericinterface

```

Usage
-----

[](#usage)

```
use Ksfraser\GenericInterface\GenericFaInterfaceTrait;

class MyModel {
    use GenericFaInterfaceTrait;
    public $foo;
    public function validate_field($field, $value) {
        if ($field === 'foo' && $value < 0) {
            throw new Exception('foo must be non-negative');
        }
        return true;
    }
}
```

Testing
-------

[](#testing)

```
cd GenericInterface
vendor/bin/phpunit --bootstrap tests/bootstrap.php tests

```

Documentation
-------------

[](#documentation)

See docs/requirements.md for requirements and test plan.

###  Health Score

32

—

LowBetter than 70% of packages

Maintenance81

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity28

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

6

Last Release

110d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ksfraser-genericinterface/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8361.6M87](/packages/propel-propel1)[mpociot/laravel-composite-key

Support composite keys in your laravel app.

3544.8k1](/packages/mpociot-laravel-composite-key)

PHPackages © 2026

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