Hello guys !
Sorry but have very simple problem on my routing, i tried to search on internet/forum but I did not find a solution. I builded my project Phalcon 2days ago with last version of devtool (i followed lastest DOC).
Here a minimal code.
This is my public/index.php :
<?php
use Phalcon\Di\FactoryDefault;
error_reporting(E_ALL);
define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');
try {
/**
* The FactoryDefault Dependency Injector automatically registers
* the services that provide a full stack framework.
*/
$di = new FactoryDefault();
/**
* Handle routes
*/
include APP_PATH . '/config/router.php';
/**
* Read services
*/
include APP_PATH . '/config/services.php';
/**
* Get config service for use in inline setup below
*/
$config = $di->getConfig();
/**
* Include Autoloader
*/
include APP_PATH . '/config/loader.php';
/**
* Handle the request
*/
$application = new \Phalcon\Mvc\Application($di);
echo str_replace(["\n","\r","\t"], '', $application->handle()->getContent());
} catch (\Exception $e) {
echo $e->getMessage() . '<br>';
echo '<pre>' . $e->getTraceAsString() . '</pre>';
}
This is my app/config/router.php :
<?php
$router = $di->getRouter();
$router->add(
'/api/currentSong',
[
'controller' => 'radio',
'action' => 'currentSong',
]
);
$router->handle();
This is my app/controllers/RadioController.php :
<?php
class RadioController extends \Phalcon\Mvc\Controller
{
public function currentSongAction()
{
return 'Just a minimal test.';
}
}
I followed lastest DOC, what is my problem ? :'( thank you in advance for your help.