mezon / fields-set
Set of typed fields
Installs: 10 584
Dependents: 5
Suggesters: 0
Security: 0
Stars: 2
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=7.2.0
Requires (Dev)
- phpunit/phpunit: ^8.5
- vimeo/psalm: ^4.2
README
Intro
You may need to store a list of typed fields for some purposes. So this class doing exactly what you need.
Installation
Just print
composer require mezon/fields-set
Creation
The creation is quite simple
$fieldsSet = new \Mezon\FieldsSet([ 'id' => [ 'type' => 'int', 'title' => 'id of the record' ], 'title' => [ 'type' => 'string', 'title' => 'some title' ], 'description' => [ 'type' => 'string', 'title' => 'quite obvious yeah?)' ] ]);
Reference
Method returns all fields in the set
public function getFields(): array
Method validates if the field exists in our set
public function hasField(string $fieldName): bool
Method returns a list of fields'es names as array:
public function getFieldsNames(): array