mezon/gui

Small gui script

1.3.7 2022-09-15 17:45 UTC

README

Build Status codecov Scrutinizer Code Quality

Intro

Mezon provides set of classes for GUI creation.

Installation

Just print in console

composer require mezon/gui

And that's all )

Usage

DateTimeUtils class

This class provides utilities for date and time tasks. For example this call:

Mezon\Class\DateTimeUtils::isToday('2020-02-02');

Will return true if the passed date is a today and false otherwise.

And this method will return true if the passed date was a yesterday:

Mezon\Class\DateTimeUtils::isYesterday('2020-02-02');

But we also can get name of the month by it's code:

Mezon\Class\DateTimeUtils::locale = 'ru';
var_dump(Mezon\Class\DateTimeUtils::dayMonth('2020-02-02'));

Fields algorithms

This class provides routines for operation with form fields. To init this class use constructor:

$fields = new \Mezon\Gui\FieldsAlgorithms([
    'id'=>['type'=>'int'],
    'description'=>['type'=>'string']
]);

Here we define two fields.

Form builder

Form builder is obviously used for building forms )

It can be done like this:

$form = new \Mezon\Gui\FormBuilder([
	'id' => [
		'type' => 'int',
		'title' => 'our entity's id'
	],
	'title' => [
		'type' => 'string',
		'title' => 'our entity's title'
	]
]);