- 
                Notifications
    You must be signed in to change notification settings 
- Fork 11
Route Aliases
        Devin Smith edited this page Dec 10, 2015 
        ·
        6 revisions
      
    Aliases allow you to map one or multiple existing routes to new routes. Params are also mapped. Each From Param is mapped to the To Param you provide.
$tipsy->router()
	->when('item/edit/:id', function($Params) {
		echo $Params->id;
	})
	->alias('item/:id/edit', 'item/edit/:id');
$tipsy->run();When requesting item/1/edit it will echo 1.
Aliases also take over the methods of the parent, so you can have multiple separate methods using the same alias.
$tipsy->router()
	->post('item/edit/:id', function($Params) {
		// save the item
	})
	->get('item/edit/:id', function($Params) {
		// retrieve the item
	})
	->alias('item/:id/edit', 'item/edit/:id');
$tipsy->run();- Home
- Getting Started
- Server Config
- Installation
- Installing Composer
- App
- Route Shorthand
- Config
- Routes
- Methods
- Controller Types
- Params & Regex
- Aliases
- Dependency Injection
- Advanced Routing
- Services
- User Defined Services
- Built in Services
- Middleware
- Views
- Templates
- Scope
- Resource
- Factory
- Looper
- Examples
- Plugins
- About