Skip to content

Instantly share code, notes, and snippets.

@phalcon
Created February 15, 2013 17:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phalcon/4961874 to your computer and use it in GitHub Desktop.
Save phalcon/4961874 to your computer and use it in GitHub Desktop.
<?php
class RobotsController extends Phalcon\Mvc\Controller
{
public function index()
{
echo "Hello Index";
}
public function show($id)
{
echo "Hello Show $id";
}
}
<?php
$loader = new \Phalcon\Loader();
$loader->registerDirs(array('controllers/'))->register();
$app = new Phalcon\Mvc\Micro();
$robotsController = new RobotsController();
//Retrieves all robots
$app->get('/', array($robotsController, 'index'));
$app->get('/robots', array($robotsController, 'index'));
$app->get('/robots/show/{id}', array($robotsController, 'show'));
$app->handle();
@prakasa1904
Copy link

but we cannot use service from $di in controller, Im already done with that.. still not work to access $this->response or $this->request from controller ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment