1. Go to this page and download the library: Download artem-alekseev/dictionaries 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/ */
artem-alekseev / dictionaries example snippets
class NameDictionary extends Dictionary
{
const ONE = 1;
const TWO = 2;
public static function getDictionary(): array
{
return [
self::ONE => 'One',
self::TWO => 'Two',
];
}
}
echo NameDictionary::ONE; // out 1
echo NameDictionary::getValueData($this->id); // id = 2 // out 'Two'
echo NameDictionary::getRange(); // out [1,2] use in validation
echo NameDictionary::getStringRange(); // out '1,2' use in validation
echo NameDictionary::getDictionary() // out [1 => 'One', 2 => 'Two'] use in selector form field
php artisan make:dictionary NameDictionary
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.