dev-master
9999999-devWeb application framework
MIT GPL-3.0+
The Requires
- php >=5.2.4
- no22/sloth dev-master
by Hiroyuki OHARA
framework
Wallogit.com
2017 © Pedro Peláez
Web application framework
Gongo is a micro web application framework for PHP 5.2 or later. It is successor to Picowa and PicowaCore framework with GongoDB., (*1)
{
"require": {
"no22/gongo": "dev-master"
}
}
Download the library and put it in your include path., (*2)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?__url__=$1 [QSA,L]
<?php
define('PATH_TO_SRC', '/path/to/src');
// using composer
require PATH_TO_SRC . '/vendor/autoload.php';
// or require PATH_TO_SRC . "path/to/gongo.php";
require PATH_TO_SRC . '/apps/your_application/app.php';
See example directory., (*3)
<?php // app.php
$app = new Gongo_App(__DIR__);
$app->get('/', function(){
return "Hello world!";
});
$app->run();
GET / or GET /index executes function getIndex($app) in application class., (*4)
<?php // app.php
class Application extends Gongo_App
{
public function getIndex($app)
{
return "Hello world!";
}
}
$app = new Application(__DIR__);
$app->init()->run();
<?php // app.php
class Application extends Gongo_App
{
public $uses = array(
'root' => 'Hello_Controller_Root',
);
}
$app = new Application(__DIR__);
$app->init()->run();
<?php // app/Hello/Controller/Root.php
class Hello_Controller_Root extends Gongo_App_Controller
{
public function getIndex($app)
{
return "Hello world!";
}
}
<?php // app/Hello/Controller/Root.php
class Hello_Controller_Root extends Gongo_App_Controller
{
public $uses = array(
// register controller alias and controller class
'/hello' => 'Hello_Controller_Hello',
);
}
<?php // app/Hello/Controller/Hello.php
class Hello_Controller_Hello extends Gongo_App_Controller
{
public function getIndex($app)
{
return "Hello world!";
}
}
GET /hello/index executes function getIndex($app) in Hello_Controller_Hello class., (*5)
GET /controller_alias/action/arg1/arg2/arg3 executes function getAction($app, $arg1, $arg2, $arg3) in controller., (*6)
<?php // app/Hello/Controller/Root.php
class Hello_Controller_Root extends Gongo_App_Controller
{
public function getHello($app, $name)
{
return "Hello {$name}!";
}
}
Gongo is dual Licensed MIT and GPLv3. You may choose the license that fits best for your project., (*7)
Web application framework
MIT GPL-3.0+
framework