We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Request Uri handling in Multi Module Application

Beginner to phalcon framework... I followed framework documentation of phalcon to create an sample project which is having multi module file structure. Where it contained module based "views" folder like below.

  • phalco-test
    • application
      • config
        • modules.config.php
    • module
      • register
        • controllers
        • models
        • views
        • Module.php
      • default
        • controllers
        • models
        • views
        • Module.php
    • public
      • .htaccess
      • index.php

Able to setup and run the application, my query is, in documentation the application handling method doesn't contain request uri as parameter

echo $application->handle()->getContent();

If we won't pass the request uri, like below

$requestUri = str_replace( $_SERVER["SCRIPT_NAME"], '', $_SERVER["REQUEST_URI"]); echo $application->handle($requestUri)->getContent();

always it will go to default controller action.. Did i missed anything or we need pass uri to work with different routes? how does it work?

Phalcon by default takes uri from $_GET['_uri'] . if you dont have that setup with rewrite rule, or you are maybe using built in php server, you can instruct router to read $_REQUEST_URI instead: $router->setUriSource(Router::URI_SOURCE_SERVER_REQUEST_URI); // use $_SERVER['REQUEST_URI']

you can read about it here -> https://docs.phalcon.io/en/latest/reference/routing.html#uri-sources