Skip to content

My Lib

Overview

mlib (My Lib) is a set of PHP (JavaScript/CSS) classes that make some frequent tasks in PHP application programming easier.
Some of these classes, which help in building client-side interfaces, come with assets (CSS, JavaScript and images in a dedicated folder).
The tools included in mlib are completely independent, meaning they don't require any framework or other library to work (except those marked with a "*").

mlib is distributed with this structure:

    - mlib/
    - mlib/     <-- PHP classes
        - assets/
            - mlib

The library can easily be installed according to the framework you use or how you organize your PHP applications.
The PHP classes are PSR compliant and should be loadable by a standard autoloader.

List of tools

  • MConfig : a class for loading configuration files halfway between xml files and properties files
  • MForm : a class for generating forms from conf files
  • MFormValidator : simply checks everything sent by a form
  • MConsole : management tables with various options
  • MCache : allows to easily store and retrieve objects or variables that are expensive to compute, in files
  • MLdap * : an object overlay for native php_ldap functions (requires php_ldap to be installed)
  • MMailer : an easy-to-use PHP mailer
  • MString : some additional functions for manipulating character strings
  • MFileSystem : adds some PHP native missing operations on directories
  • MMessenger : a simple way to display messages (info, warnings, errors...) across pages
  • MTree : to display a tree
  • MAjaxZone : an easy way to create a zone with an ajax content
  • MTooltip : to do a little better than the 'title' attribute
  • MCaptcha * : to add a CAPTCHA to a form (requires php_gd)
  • MLogger : a set of classes for logging messages in different ways
  • MEncoderDecoder * : easily encode/decode strings (requires OpenSSL library to be installed)
  • MAutoComplete : to display a dynamic search field

Documentation

mlib comes with a wwwsamples directory.
You can easily install wwwsamples on a web server:
copy the wwwsamples folder somewhere on your web server (usually under /var/www/ or /var/www/html/ on a Linux distribution)
copy the mlib folder into the wwwsamples directory

Running these samples in a web browser gives a good overview of the library's capabilities.
Some of the classes in mlib have their own documentation, others don't. For the latter, the inline code documentation should be clear enough for use.