ksfraser / genericinterface
Generic interface trait for database models, with validation hooks.
0.6.0
2026-02-20 03:55 UTC
Requires (Dev)
- phpunit/phpunit: ^9.0
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.