PHP code example of nkey / caribu-mvc
1. Go to this page and download the library: Download nkey/caribu-mvc library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nkey / caribu-mvc example snippets
\Nkey\Caribu\Mvc\Controller\AbstractController;
use \Nkey\Caribu\Mvc\Controller\Request;
use \Nkey\Caribu\Mvc\Application;
use \Nkey\Caribu\Mvc\View\AbstractView;
use \Generics\Logger\ExtendedLogger;
/**
* A simple test controller
*
* @author Maik Greubel <[email protected]>
*
* This file is part of Caribu MVC package
*/
class IndexController extends AbstractController
{
/**
* @webMethod
*
* @title Hey there page
*/
public function index()
{
echo "Hey, there!\n\n";
}
/**
* @responseType text/plain
*
* @param \Nkey\Caribu\Mvc\Controller\Request $request
*/
public function paramTest(Request $request)
{
foreach ($request->getParams() as $param => $value) {
printf("%s => %s\n", $param, $value);
}
}
}
// Preparing
Application::getInstance()->registerController('IndexController')
->setLogger(new ExtendedLogger());
// Serving
Application::getInstance()->serve();