PHP Classes

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

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 29 All time: 11,146 This week: 206Up
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: 184954 in Russian Federation Russian Federation
Week rank: 200 Up8 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 (6)  
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 (6)  /  Tests  
File Role Description
  Plain text file FieldsSetUnitTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:29
This week:0
All time:11,146
This week:206Up