PHP code example of ksfraser / genericinterface

1. Go to this page and download the library: Download ksfraser/genericinterface library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ksfraser / genericinterface example snippets


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;
    }
}

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