update docs/examples
This commit is contained in:
parent
51867226be
commit
2658600afe
|
@ -29,7 +29,7 @@ There are **better options** out there now
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
- PHP 5.3+
|
- PHP 5.4+ ([], php -S)
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -38,6 +38,8 @@ Create an `index.php` file and put the following code in it
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
|
||||||
|
<?php require(PATH_TO_MITE);
|
||||||
|
|
||||||
class Prototype extends Mite {
|
class Prototype extends Mite {
|
||||||
|
|
||||||
function index()
|
function index()
|
||||||
|
@ -61,6 +63,5 @@ The file name as `index.php` is important for routing
|
||||||
|
|
||||||
- More Examples
|
- More Examples
|
||||||
- Document API
|
- Document API
|
||||||
- Modernize (ditch 5.2), but remain small
|
|
||||||
- Mite DB construct take PDO object, not build one
|
- Mite DB construct take PDO object, not build one
|
||||||
- Support REST functionality
|
- Support REST functionality
|
|
@ -1,13 +1,13 @@
|
||||||
<?php require('../vendor/autoload.php');
|
<?php require(__DIR__ . '/../src/mite.php');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Example: 5.3 OOP Anonymous Functions
|
* Example: 5.3 OOP Anonymous Functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$app = new Mite(array('debug' => TRUE, 'index' => __FILE__));
|
$app = new Mite(['debug' => TRUE, 'index' => __FILE__]);
|
||||||
|
|
||||||
$app->route('/', function() use($app) {
|
$app->route('/53oop.php', function() use($app) {
|
||||||
$app->view('views/index.tpl.php');
|
$app->view('index.tpl.php');
|
||||||
});
|
});
|
||||||
|
|
||||||
$app->run();
|
$app->run();
|
|
@ -1,4 +1,4 @@
|
||||||
<?php require('../vendor/autoload.php');
|
<?php require(__DIR__ . '/../src/mite.php');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Example: Using MITE as a base class
|
* Example: Using MITE as a base class
|
||||||
|
@ -7,10 +7,10 @@ class test extends Mite {
|
||||||
|
|
||||||
function index()
|
function index()
|
||||||
{
|
{
|
||||||
$this->view('views\index.tpl.php');
|
$this->view('index.tpl.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$app = new test(array('debug' => TRUE, 'index' => __FILE__));
|
$app = new test(['debug' => TRUE, 'index' => __FILE__]);
|
||||||
$app->route('/', 'index');
|
$app->route('/extend.php', 'index');
|
||||||
$app->run();
|
$app->run();
|
Loading…
Reference in New Issue