PHP code example of horat1us / yii2-model-schema
1. Go to this page and download the library: Download horat1us/yii2-model-schema 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/ */
horat1us / yii2-model-schema example snippets
declare(strict_types=1);
namespace App;
use Horat1us\Yii\Model;
use yii\base;
$model = new class extends base\Model implements Model\AttributesExamples {
use Model\AttributesExamplesTrait;
public function attributesExamples(): array {
return [
'a' => [1,2],
'b' => [],
];
}
};
echo $model->getAttributeExamples('a'); // [1,2]
echo $model->getAttributeExamples('b'); // null
echo $model->getAttributeExamples('c'); // null
echo $model->getAttributeExample('a'); // 1
echo $model->getAttributeExample('b'); // null
echo $model->getAttributeExample('c'); // null