mtoolkit / mtoolkit-core
The core module of MToolkit framework
0.0.3
2017-11-06 14:33 UTC
Requires
- php: >=5.3.0
- monolog/monolog: ^1.23
Requires (Dev)
- phpunit/phpunit: 5.1.*
This package is not auto-updated.
Last update: 2024-12-17 22:36:09 UTC
README
The core module of MToolkit framework.
Summary
Install
{ "require": { "mtoolkit/mtoolkit-core": "..." } }
Or run the console command:
composer require mpstyle/mtoolkit-core
Into
The core module contains some utility classes like: MList, MGet, MPost.
Theese wrap the core functionalities of PHP in a class. Let me explain.
MList
It implements a list of object (custom or primitive) and provides the methods to work with them:
- append: adds a new item at the end of the list
- appendArray: adds all the item in the array argument at the end of the list
- clear: empty the list
- count: returns the number of the item
- isEmpty: removes all items from list They are only some of the methods to work with a list of objects.
MGet and MPost
As the names suggest, you can use theese classes to access to the globals $_GET and $_POST. They are "read only" MMap, so it is impossible to call methods as: clear, erase and others. To retrieve the value in the global $_GET write:
$get=new MGet(); $id=$get->getValue('id');
In a similar way for $_POST:
$post=new MPost(); $id=$post->getValue('id');
If 'id' is not set, it returns null.