Cakephp 3.0 | Methods to get base and application url

Author - Parminder Kaur

In cakephp we do not need to set hard coded relative paths.There are methods by calling which we can build the url dynamically.

use Cake\Routing\Router;
To get the base url use
Router::fullBaseUrl(); => http://localhost //Output

To get the Application Url
Router::url(); =>/CakeApp/ //Output

To build complete URL of controller and method called:

//output is

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published.