PHP Classes
elePHPant
Icontem

Caribu MVC: MVC framework with controllers using annotations

Recommend this page to a friend!
  Info   View files Example   View files View files (45)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-08-19 (2 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 2 This week: 2All time: 9,072 This week: 346Up
Version License PHP version Categories
caribu-mvc 1.0GNU General Publi...7Design Patterns, PHP 7
Description Author

This package is a MVC framework with controllers using annotations.

It provides base controller classes that need to be extended by applications to handler application requests.

The package extracts annotations from the actual application controller classes to determine how requests should be routed.

  Performance   Level  
Name: Maik Greubel <contact>
Classes: 10 packages by
Country: Germany Germany
Innovation award
Innovation award
Nominee: 4x

Details

Build Status Scrutinizer Code Quality Code Coverage Dependency Status

caribu-mvc

Tiny annotation based MVC framework

For now only a simple example, what you can do with Caribu MVC.

composer.json:

{
  "require" : {
    "nkey/caribu-mvc" : "dev-master",
    "nkey/phpgenerics" : "dev-master",
    "psr/log" : "1.0.0"
  }
}

public/index.php:

<?php
require dirname(__FILE__) . '/../vendor/autoload.php';

use \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 <greubel@nkey.de>
 *
 *         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();

Then in your browser window open http://host/ and see the output of index() web method. The address http://host/index, as well as http://host/index/index provides the same functionality.

Surf to http://host/index/paramTest/param1/Hello/param2/Caribu or to get the same output the address http://host/index/paramTest?param1=Hello&param2=Caribu

Documentation follows soon in wiki.

  Files folder image Files  
File Role Description
Files folder imagecontrib (2 files)
Files folder imagesrc (1 directory)
Files folder imagetests (3 files, 2 directories)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file build.xml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpcs.xml Data Auxiliary data
Accessible without login Plain text file phpdox.xml Data Auxiliary data
Accessible without login Plain text file phpmd.xml Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  contrib  
File Role Description
  Accessible without login Plain text file phpcs.xsd Data Auxiliary data
  Accessible without login Plain text file phpunit.xsd Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageMvc (1 file, 4 directories)

  Files folder image Files  /  src  /  Mvc  
File Role Description
Files folder imageController (5 files)
Files folder imageRouter (2 files)
Files folder imageUtil (2 files)
Files folder imageView (5 files, 1 directory)
  Plain text file Application.php Class Class source

  Files folder image Files  /  src  /  Mvc  /  Controller  
File Role Description
  Plain text file AbstractController.php Class Class source
  Plain text file ControllerException.php Class Class source
  Plain text file ErrorController.php Class Class source
  Plain text file Request.php Class Class source
  Plain text file Response.php Class Class source

  Files folder image Files  /  src  /  Mvc  /  Router  
File Role Description
  Plain text file AbstractRouter.php Class Class source
  Plain text file RouterException.php Class Class source

  Files folder image Files  /  src  /  Mvc  /  Util  
File Role Description
  Plain text file RequestParser.php Class Class source
  Plain text file Session.php Class Class source

  Files folder image Files  /  src  /  Mvc  /  View  
File Role Description
Files folder imageControls (3 files)
  Plain text file AbstractView.php Class Class source
  Plain text file Control.php Class Class source
  Plain text file DefaultView.php Class Class source
  Plain text file View.php Class Class source
  Plain text file ViewException.php Class Class source

  Files folder image Files  /  src  /  Mvc  /  View  /  Controls  
File Role Description
  Plain text file ControlException.php Class Class source
  Plain text file Form.php Class Class source
  Plain text file Image.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imagefeature-test (9 files)
Files folder imagerouter-test (4 files)
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file index.php Example Example script
  Accessible without login Plain text file SimpleController.php Example Class source

  Files folder image Files  /  tests  /  feature-test  
File Role Description
  Plain text file ControlsController.php Class Class source
  Plain text file ControlsTest.php Class Class source
  Plain text file DoNothingView.php Class Class source
  Plain text file FeatureTest.php Class Class source
  Plain text file FeatureTestController.php Class Class source
  Plain text file InvalidController.php Class Class source
  Plain text file InvalidView.php Class Class source
  Plain text file RequestTest.php Class Class source
  Plain text file ViewTest.php Class Class source

  Files folder image Files  /  tests  /  router-test  
File Role Description
  Plain text file RoutedController.php Class Class source
  Plain text file RoutingTest.php Class Class source
  Plain text file RoutingTestController.php Class Class source
  Plain text file TestRouter.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:2
This week:2
All time:9,072
This week:346Up