iPinga is most easily installed and kept up to date by using Composer (Dependency Manager for PHP). You can, indeed, simply download the source code and install it yourself, but why? Installing it via Composer will allow you to keep iPinga up to date with ease and it’s what all the cool kids are doing these days. 🙂 The following steps detail how to setup iPinga with your own application. It is highly recommended that you download the iPinga Starter App to see how it all comes together. This is handy if you learn better by looking at how someone else has done it.
System Requirements
- Composer
- PHP 5.3 or higher
- mcrypt extension
Installation
Create a composer.json
file in your project’s root folder and add the following lines:
1 2 3 4 5 |
{ "require": { "vernsix/ipinga": "^1.0" } } |
Tell composer to install the library:
1 |
composer install |
Add this line to your application’s index.php
file:
1 |
<?php require 'vendor/autoload.php' ?> |
Instantiate the iPinga application:
1 |
$iPinga = new \ipinga\ipinga(); |
Build a controller file (controllers/helloworld.controller.php
) to handle the request:
1 2 3 4 5 6 7 |
Class helloworldController Extends \ipinga\controller { public function index() { echo 'Hello World'; } } |
Define a route to call this controller/method:
1 |
$iPinga->addRoute('/','helloworld','index'); |
Run the iPinga application:
1 |
$iPinga->run(); |