ksfraser/genericinterface

Generic interface trait for database models, with validation hooks.

Maintainers

Package info

github.com/ksfraser/GenericInterface

pkg:composer/ksfraser/genericinterface

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.6.0 2026-02-20 03:55 UTC

This package is auto-updated.

Last update: 2026-02-20 03:56:08 UTC


README

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

Installation

composer require ksfraser/genericinterface

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

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

Documentation

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