-
Notifications
You must be signed in to change notification settings - Fork 10
Route Methods
Devin Smith edited this page Dec 11, 2015
·
1 revision
The router object sends all method calls through the when
method using either a 1 or 2 parameter call.
Accepts 2 parameters: route and controller. Used for defining a route that matches any method.
$tipsy->router()->when('hello',function() {
echo 'World';
});
Accepts 1 parameter: controller. Used for specifying the home page. This is equivalent to specifying an empty ''
or '/'
when method.
$tipsy->router()->home(function() {
echo 'Honey, Im home!';
});
Accepts 2 parameters: route and controller. Used for defining a route with a specific method. You can use absolutely any method. Even made up ones.
$tipsy->router()->post(function() {
echo 'Yay! Posting stuff!';
});
$tipsy->router()->bacon(function() {
echo 'This is a bacon method!';
});
Accepts parameter: controller. If no match is found, the otherwise function will be called. Used for default, or 404 pages.
$tipsy->router()->otherwise(function() {
echo '404';
});
- 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