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    
Last Updated Ratings Unique User Downloads Download Rankings
2020-10-23 (23 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 17 This week: 16All time: 10,096 This week: 23Up
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: 27 packages by
Country: Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 3x

 

Details

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:17
This week:16
All time:10,096
This week:23Up

For more information send a message to info at phpclasses dot org.