Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9005215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:05:05+00:00 2026-06-16T01:05:05+00:00

Here, in docs, is written about how to create routes: http://docs.phalconphp.com/en/latest/reference/routing.html But i can’t

  • 0

Here, in docs, is written about how to create routes:
http://docs.phalconphp.com/en/latest/reference/routing.html

But i can’t find how i can inject them in application.
What i need to do, to make my application use defined routes?

Should i inject router (or how?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:05:07+00:00Added an answer on June 16, 2026 at 1:05 am

    The router can be registered in the DI (in your public/index.php) this way:

    $di->set('router', function() {
    
        $router = new \Phalcon\Mvc\Router();
    
        $router->add("/login", array(       
            'controller' => 'login',
            'action' => 'index',
        ));
    
        $router->add("/products/:action", array(        
            'controller' => 'products',
            'action' => 1,
        ));
    
        return $router;
    });
    

    Also is possible to move the registration of routes to a separate file in your application (i.e app/config/routes.php) this way:

    $di->set('router', function(){
        require __DIR__.'/../app/config/routes.php';
        return $router;
    });
    

    Then in the app/config/routes.php file:

    <?php
    
    $router = new \Phalcon\Mvc\Router();
    
    $router->add("/login", array(       
        'controller' => 'login',
        'action' => 'index',
    ));
    
    $router->add("/products/:action", array(        
        'controller' => 'products',
        'action' => 1,
    ));
    
    return $router;
    

    Examples: https://github.com/phalcon/php-site/blob/master/public/index.php#L33 and https://github.com/phalcon/php-site/blob/master/app/config/routes.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to follow the instructions here ( http://docs.pylonsproject.org/projects/pyramid_beaker/en/latest/ ) so I can setup
Here: http://download.oracle.com/docs/html/A95907_01/diff_uni.htm#1077398 I found that on Windows Oracle is thread based, while on Unix
Here is the subsonic asp.net mvc application http://subsonicproject.com/docs/MVC_Starter_Template but its for MVC 1.0. How
Ok, I read docs very precisely here: http://developer.android.com/guide/topics/providers/calendar-provider.html#update-event and its written something like this:
Reading the section Zend_Application_Resource_Modules in the docs here: http://framework.zend.com/manual/1.10/en/zend.application.available-resources.html I noticed this: You can
I have looked at the documentation here: http://docs.python.org/dev/library/xml.etree.elementtree.html#xml.etree.ElementTree.SubElement The parent and tag argument seems
Seeking help to design a layout as shown here: http://docs.google.com/Doc?docid=0AQhgDtGvE2HgZGZ6cmtua185MTd0eGdyZmc&hl=en The major challenge I
I'm trying to add a custom catalog index based on the recommendation here: http://collective-docs.readthedocs.org/en/latest/searching_and_indexing/indexing.html#custom-index-methods
Here's an example taken from http://docs.jquery.com/API/1.1/AJAX#.24.post.28_url.2C_params.2C_callback_.29 $.ajax({ type: POST, url: some.php, data: name=John&location=Boston, success:
Here, the Sencha team explains how to have a one to many relationship: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.