PHP Classes

Mezon Fields Set: Manipulate a set of field types and constraints

Recommend this page to a friend!
  Info   View files Documentation   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 28 All time: 11,069 This week: 571Up
Version License PHP version Categories
mezon-fields-set 1.0MIT/X Consortium ...5PHP 5, Data types
Description 

Author

This package can manipulate a set of field types and constraints.

It can take an associative array as parameter to store and retrieve a set of field values.

The class provides functions to perform several types of operations like:

- Get the list of all fields
- Check if it exists a field with a given name
- Get the names of all fields
- Get the type of one field
- Check if there are field of type custom
- Remove one field of the list

Picture of Alexey Dodonov
  Performance   Level  
Name: Alexey Dodonov <contact>
Classes: 58 packages by
Country: Russian Federation Russian Federation
Age: ???
All time rank: 185254 in Russian Federation Russian Federation
Week rank: 52 Up2 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 13x

Documentation

Base application class Build Status codecov

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

  Files folder image Files  
File Role Description
Files folder imageTests (1 file)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Plain text file FieldsSet.php Class Class source
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  Tests  
File Role Description
  Plain text file FieldsSetUnitTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:28
This week:0
All time:11,069
This week:571Up