Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Symfony2 Essentials

You're reading from   Symfony2 Essentials

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781784398767
Length 158 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Routing

Like with many other frameworks based on the concept of MVC, before any controller is actually executed, Symfony2 needs to know how to handle it. The Symfony routing configuration starts within the app/config/routing_*.yml file. Depending on which environment you fire up, this version of routing is fired up. Usually, this environment file loads the main app/config/routing.yml file, which loads other files from vendors, bundles, and so on. You can, of course, directly define your own single routings here, but it's usually recommended to keep the bundle-specific routings within the bundle itself, while using the main routing only to import resources.

As per the example provided earlier in this chapter, we know our app tries to import another resource file defined as @AppBundle/Resources/config/routing.yml. The @BundleName syntax is a shortcut to the bundle namespace (in our case AppBundle) but namespace can be longer if you include the vendor in your name. Let's take a look...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image