mite-php-legacy/README.md

1.5 KiB

Mite

The tiniest framework that mite work

A word of warning, this is an experiment that I'm resurrecting, so it's quite dated atm


     /___\        ___ _
     )O.o(  |\/| o | |_   BE small
     \_^_/  |  | | | |_   be STRONG
      " "

Overview

Mite is a single-file framework that was born out of a necessity of its time, circa 2011, to enable rapid prototyping for PHP. When ideas came too fast to capture in most conventional frameworks for PHP, Mite provided a one-include-and-go solution.

This was also the first time I had the idea to break away from MVC structure and just build something based around routing. Turned out this idea was not mine alone, it started with sinatra.rb, and continued with express.js.

There are better options out there now

Features

Requirements

  • PHP 5.3+

Usage

Create an index.php file and put the following code in it


class Prototype extends Mite {

    function index()
    {
        // *.tpl.* not required
        $this->view('index.tpl.php');
    }
}

$app = new Prototype();
$app->route('/', 'index');
$app->run();

The file name as index.php is important for routing

SEE: examples/

TODO

  • More Examples
  • Document API
  • Modernize (ditch 5.2), but remain small
  • Mite DB construct take PDO object, not build one
  • Support REST functionality