https://github.com/alexdodonov/mezon-fields-set
set of fields with types and constraints
https://github.com/alexdodonov/mezon-fields-set
Last synced: 3 months ago
JSON representation
set of fields with types and constraints
- Host: GitHub
- URL: https://github.com/alexdodonov/mezon-fields-set
- Owner: alexdodonov
- Created: 2020-04-09T15:22:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-18T16:43:23.000Z (almost 4 years ago)
- Last Synced: 2025-06-15T17:22:45.858Z (4 months ago)
- Language: PHP
- Size: 15.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Base application class [](https://travis-ci.com/alexdodonov/mezon-fields-set) [](https://codecov.io/gh/alexdodonov/mezon-fields-set)
## 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
```PHP
$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
```PHP
public function getFields(): array
```Method validates if the field exists in our set
```PHP
public function hasField(string $fieldName): bool
```Method returns a list of fields'es names as array:
```PHP
public function getFieldsNames(): array
```