PHP Classes
elePHPant
Icontem

MToolkit: PHP Web application framework that supports MVC

Recommend this page to a friend!
  Info   View files Documentation   View files View files (160)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2015-12-04 (10 months ago) RSS 2.0 feedNot enough user ratingsTotal: 172 All time: 8,026 This week: 1,109Up
Version License PHP version Categories
mpstyle_mtoolkit 0.1GNU Lesser Genera...5.3PHP 5, Libraries, Design Patterns
Description Author

This package is a PHP Web application framework that supports MVC.

It provides a collection of classes for many purposes of Web applications including autoloading, different types of base controlller classes, base model classes, HTTP request handling, debugging, file and directory access, caching, date and time manipulation, etc..

Picture of Michele Pagnin
Name: Michele Pagnin <contact>
Classes: 1 package by
Country: Italy Italy

Details

MToolkit

MToolkit is a simple PHP toolkit, it is compliant with the PSR-0 Standard: - A fully-qualified namespace and class must have the following structure \\\<Vendor Name>\\\(\<Namespace\>)*\\\<Class Name>. - Each namespace must have a top-level namespace ("Vendor Name"). (Missing) - Each namespace can have as many sub-namespaces as it wishes. - Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system. - Each underscore in the class name is converted to a DIRECTORY_SEPARATOR. The underscore has no special meaning in the namespace. - The fully-qualified namespace and class is suffixed with .php when loading from the file system. - Alphabetic characters in vendor names, namespaces, and class names may be of any combination of lower case and upper case.

It borns from a requirement: develop a website quickly and powerfully.

I know, someone can says "Use Zend Framwork, CakePHP!", but I could answer: "They are very good toolkits, but they aren't the toolkit that I want!" :P

The development model of MToolkit is rolling release. I search some people (developer or not) to increase and modify this strategy: my goal is to manage the versioning of this framework.

The experiences with other toolkit in different platforms have led to create this toolkit.

MToolkit borns like a mash-up of two frameworks: .NET and Qt. o_O

Yes, the framework of the evil and the desktop framework for excellence.

Some good features

  • Completely Object Oriented
  • Autoload of classes (PSR-0 Standard)
  • Autorun of pages and of RPC Json web services from controller classes
  • Javascript frameworks compatibility (jQuery, Bootstrap, etc)
  • Master page concept (http://msdn.microsoft.com/it-it/library/system.web.ui.masterpage.aspx)
  • Separation between business logic and graphics
  • Fluent setters

MToolkit components

Like Qt, MToolkit has a lot of components, one for every type of usage. Here the list: - Core - Network - Model/Sql - Controller - View

Software using MToolkit

Let's start

Create a folder for your project.

Download the latest version of MToolkit in the project folder.

On the root of your project create a new file (Settings.php) with this content:


<?php
require_once __DIR__.'/MToolkit/Core/MCore.php';

use MToolkit\Core\MApplication;

class Settings
{
    public static function run()
    {
        // Set the root path of the project
        MApplication::setApplicationDirPath(__DIR__);
    }
}

Settings::run();

This file sets the root of your project and now you no longer have to use require, require_once, include, include_once directives.

This file must be include in every entry page of your project.

Entry page

An entry page is the page loaded at start time. Now, we will see how create the controller of the entry page and his html code.

Controller (Index.php):

<?php

require_once __DIR__ . '/Settings.php';

use \MToolkit\Controller\MAbstractPageController;

class Index extends MAbstractPageController
{
    private $masterPage;

    public function __construct()
    {
        parent::__construct(__DIR__.'/Index.view');
    }

    public function helloWorld()
    {
        return "Hello World";
    }
} 

        
        

And the view file. Every view file must contains the meta tag, with the correct content-type:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Index.view:

<?php /@var $this Index/ ?>
<html>
    <head>
        <title>Entry page</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <b><?php echo $this->helloWorld(); ?></b>
    </body>
</html>

Using Composer

composer.json:

{
  "require": {
    "mpstyle/mtoolkit": "dev-master"
  }
}

On the root of your project create a new file (Settings.php) with this content:


<?php
require_once __DIR__ . '/vendor/autoload.php';

use MToolkit\Core\MApplication;

class Settings
{
    public static function run()
    {
        // Set the root path of the project
        MApplication::setApplicationDirPath(__DIR__);
    }
}

Settings::run();

And now you can create your web app.

  Files folder image Files  
File Role Description
Files folder imageController (9 files)
Files folder imageCore (24 files, 7 directories)
Files folder imageDebugConsole (8 files, 4 directories)
Files folder imageModel (5 files, 1 directory)
Files folder imagenbproject (2 files, 1 directory)
Files folder imageNetwork (5 files, 2 directories)
Files folder imageUnitTest (1 file, 1 directory)
Files folder imageUser (1 file)
Files folder imageView (3 files, 2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login HTML file index.html Data Empty document
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  Controller  
File Role Description
  Plain text file MAbstractController.php Class Class source
  Plain text file MAbstractHttpHandler.php Class Class source
  Plain text file MAbstractMasterPageController.php Class Class source
  Plain text file MAbstractPageController.php Class Class source
  Plain text file MAbstractViewController.php Class Class source
  Plain text file MDropDownList.php Class Class source
  Plain text file MHttpResponse.php Class Class source
  Plain text file MRepeaterView.php Class Class source
  Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files  /  Core  
File Role Description
Files folder imageCache (5 files)
Files folder imageDateTime (3 files)
Files folder imageEnum (6 files)
Files folder imageException (8 files)
Files folder imageJson (2 files)
Files folder imageMDir (2 files)
Files folder imageMFileDevice (1 file)
  Accessible without login HTML file index.html Data Empty document
  Plain text file MAbstractTemplate.php Class Class source
  Plain text file MApplication.php Class Class source
  Plain text file MCore.php Class Class source
  Plain text file MCoreApplication.php Class Class source
  Plain text file MDataType.php Class Class source
  Plain text file MDir.php Class Class source
  Plain text file MFileInfo.php Class Class source
  Plain text file MFileInfoList.php Class Class source
  Plain text file MGet.php Class Class source
  Plain text file MGlobal.php Class Class source
  Plain text file MHash.php Class Class source
  Plain text file MList.php Class Class source
  Plain text file MLog.php Class Class source
  Plain text file MMap.php Class Class source
  Plain text file MMobileDetector.php Class Class source
  Plain text file MObject.php Class Class source
  Plain text file MPost.php Class Class source
  Plain text file MString.php Class Class source
  Plain text file MStringList.php Class Class source
  Plain text file MThread.php Class Class source
  Plain text file MTime.php Class Class source
  Plain text file MTranslator.php Class Class source
  Plain text file MVector.php Class Class source

  Files folder image Files  /  Core  /  Cache  
File Role Description
  Plain text file MAbstractCache.php Class Class source
  Plain text file MAPCCache.php Class Class source
  Plain text file MFileCache.php Class Class source
  Plain text file MMySQLCache.php Class Class source
  Plain text file MSQLiteCache.php Class Class source

  Files folder image Files  /  Core  /  DateTime  
File Role Description
  Accessible without login HTML file index.html Data Empty document
  Plain text file TimeInMilliseconds.php Class Class source
  Plain text file TimeInSeconds.php Class Class source

  Files folder image Files  /  Core  /  Enum  
File Role Description
  Plain text file AspectRatioMode.php Class Class source
  Plain text file CaseSensitivity.php Class Class source
  Plain text file ContentType.php Class Class source
  Plain text file HashAlgorithm.php Class Class source
  Accessible without login HTML file index.html Data Empty document
  Plain text file Orientation.php Class Class source

  Files folder image Files  /  Core  /  Exception  
File Role Description
  Accessible without login HTML file index.html Data Empty document
  Plain text file MArgumentOutOfRangeException.php Class Class source
  Plain text file MElementIdNotFoundException.php Class Class
  Plain text file MReadOnlyObjectException.php Class Class source
  Plain text file MTemplateNotFoundException.php Class Class source
  Plain text file MThreadException.php Class Class source
  Plain text file MTranslationFilePa...tFoundException.php Class Class source
  Plain text file MWrongTypeException.php Class Class source

  Files folder image Files  /  Core  /  Json  
File Role Description
  Accessible without login HTML file index.html Data Empty document
  Plain text file MJsonObject.php Class Class source

  Files folder image Files  /  Core  /  MDir  
File Role Description
  Plain text file Filter.php Class Class source
  Plain text file SortFlag.php Class Class source

  Files folder image Files  /  Core  /  MFileDevice  
File Role Description
  Plain text file FilePermission.php Class Class source

  Files folder image Files  /  DebugConsole  
File Role Description
Files folder imageImages (3 files)
Files folder imageJavascripts (1 file)
Files folder imageLanguages (2 files)
Files folder imageMasterPages (2 files)
  Accessible without login HTML file index.html Data Empty document
  Accessible without login Plain text file Index.php Appl. Application script
  Accessible without login Plain text file Index.view.php Appl. Application script
  Plain text file Log.php Class Class source
  Accessible without login Plain text file Log.view.php Appl. Application script
  Plain text file QuickStart.php Class Class source
  Plain text file QuickStart.view.php Class Class source
  Plain text file Settings.php Class Class source

  Files folder image Files  /  DebugConsole  /  Images  
File Role Description
  Accessible without login Image file BigLogo.png Data Auxiliary data
  Accessible without login Image file MediumLogo.png Data Auxiliary data
  Accessible without login Image file SmallLogo.png Icon Icon image

  Files folder image Files  /  DebugConsole  /  Javascripts  
File Role Description
  Accessible without login Plain text file Log.js Data Auxiliary data

  Files folder image Files  /  DebugConsole  /  Languages  
File Role Description
  Accessible without login Plain text file en-en.json Data Auxiliary data
  Plain text file Languages.php Class Class source

  Files folder image Files  /  DebugConsole  /  MasterPages  
File Role Description
  Plain text file MainMasterPage.php Class Class source
  Accessible without login Plain text file MainMasterPage.view.php Appl. Application script

  Files folder image Files  /  Model  
File Role Description
Files folder imageSql (11 files)
  Accessible without login HTML file index.html Data Empty document
  Plain text file MAbstractDataModel.php Class Class source
  Plain text file MFileSystemModel.php Class Class source
  Plain text file MListModel.php Class Class source
  Plain text file MTableModel.php Class Class source

  Files folder image Files  /  Model  /  Sql  
File Role Description
  Accessible without login HTML file index.html Data Empty document
  Plain text file MAbstractSqlQuery.php Class Class source
  Plain text file MAbstractSqlResult.php Class Class source
  Plain text file MDbConnection.php Class Class source
  Plain text file MPDOQuery.php Class Class source
  Plain text file MPDOResult.php Class Class source
  Plain text file MSql.php Class Class source
  Plain text file MSqlError.php Class Class source
  Plain text file MSqlField.php Class Class source
  Plain text file MSqlQueryModel.php Class Class source
  Plain text file MSqlRecord.php Class Class source

  Files folder image Files  /  nbproject  
File Role Description
Files folder imageprivate (1 file)
  Accessible without login Plain text file project.properties Data Auxiliary data
  Accessible without login Plain text file project.xml Data Auxiliary data

  Files folder image Files  /  nbproject  /  private  
File Role Description
  Accessible without login Plain text file private.properties Data Auxiliary data

  Files folder image Files  /  Network  
File Role Description
Files folder imageHTTP (3 files)
Files folder imageRPC (4 files, 1 directory)
  Accessible without login HTML file index.html Data Empty document
  Plain text file MNetworkCookie.php Class Class source
  Plain text file MNetworkRequest.php Class Class source
  Plain text file MNetworkSession.php Class Class source
  Plain text file MUrl.php Class Class source

  Files folder image Files  /  Network  /  HTTP  
File Role Description
  Plain text file MHttpHeaders.php Class Class source
  Plain text file MHttpRequest.php Class Class source
  Plain text file MHttpResponse.php Class Class source

  Files folder image Files  /  Network  /  RPC  
File Role Description
Files folder imageJson (5 files, 2 directories)
  Accessible without login HTML file index.html Data Empty document
  Plain text file MRPCError.php Class Class source
  Plain text file MRPCRequest.php Class Class source
  Plain text file MRPCResponse.php Class Class source

  Files folder image Files  /  Network  /  RPC  /  Json  
File Role Description
Files folder imageClient (3 files)
Files folder imageServer (3 files)
  Accessible without login HTML file index.html Data Empty document
  Plain text file MRPCJson.php Class Class source
  Plain text file MRPCJsonError.php Class Class source
  Plain text file MRPCJsonRequest.php Class Class source
  Plain text file MRPCJsonResponse.php Class Class source

  Files folder image Files  /  Network  /  RPC  /  Json  /  Client  
File Role Description
  Accessible without login HTML file index.html Data Empty document
  Plain text file MRPCJsonClient.php Class Class source
  Plain text file MRPCJsonClientException.php Class Class source

  Files folder image Files  /  Network  /  RPC  /  Json  /  Server  
File Role Description
  Accessible without login HTML file index.html Data Empty document
  Plain text file MRPCJsonException.php Class Class source
  Plain text file MRPCJsonWebService.php Class Class source

  Files folder image Files  /  UnitTest  
File Role Description
Files folder imageCore (4 files)
  Accessible without login Plain text file bootstrap.php Aux. Class source

  Files folder image Files  /  UnitTest  /  Core  
File Role Description
  Plain text file MAbstractTemplateTest.php Class Class source
  Plain text file MCoreApplicationTest.php Class Class source
  Plain text file MDataTypeTest.php Class Class source
  Plain text file MListTest.php Class Class source

  Files folder image Files  /  User  
File Role Description
  Accessible without login HTML file index.html Data Empty document

  Files folder image Files  /  View  
File Role Description
Files folder imageJavascripts (4 files)
Files folder imageQueryPath (10 files, 2 directories)
  Accessible without login HTML file index.html Data Empty document
  Plain text file MImage.php Class Class source
  Plain text file QueryPath.php Class Class source

  Files folder image Files  /  View  /  Javascripts  
File Role Description
  Accessible without login Plain text file MQueryString.js Data Auxiliary data
  Accessible without login Plain text file MQueryString.min.js Data Auxiliary data
  Accessible without login Plain text file MString.js Data Auxiliary data
  Accessible without login Plain text file MString.min.js Data Auxiliary data

  Files folder image Files  /  View  /  QueryPath  
File Role Description
Files folder imageCSS (12 files, 1 directory)
Files folder imageExtension (2 files)
  Plain text file DOMQuery.php Class Class source
  Plain text file Entities.php Class Class source
  Plain text file Exception.php Class Class source
  Plain text file Extension.php Class Class source
  Plain text file ExtensionRegistry.php Class Class source
  Plain text file IOException.php Class Class source
  Plain text file Options.php Class Class source
  Plain text file ParseException.php Class Class source
  Plain text file Query.php Class Class source
  Plain text file QueryPathIterator.php Class Class source

  Files folder image Files  /  View  /  QueryPath  /  CSS  
File Role Description
Files folder imageDOMTraverser (2 files)
  Plain text file DOMTraverser.php Class Class source
  Plain text file EventHandler.php Class Class source
  Plain text file InputStream.php Class Class source
  Plain text file NotImplementedException.php Class Class source
  Plain text file ParseException.php Class Class source
  Plain text file Parser.php Class Class source
  Plain text file QueryPathEventHandler.php Class Class source
  Plain text file Scanner.php Class Class source
  Plain text file Selector.php Class Class source
  Plain text file SimpleSelector.php Class Class source
  Plain text file Token.php Class Class source
  Plain text file Traverser.php Class Class source

  Files folder image Files  /  View  /  QueryPath  /  CSS  /  DOMTraverser  
File Role Description
  Plain text file PseudoClass.php Class Class source
  Plain text file Util.php Class Class source

  Files folder image Files  /  View  /  QueryPath  /  Extension  
File Role Description
  Plain text file QPXML.php Class Class source
  Plain text file QPXSL.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:172
This week:0
All time:8,026
This week:1,109Up