-
Notifications
You must be signed in to change notification settings - Fork 10
Dependency Injection
Devin Smith edited this page Dec 10, 2015
·
3 revisions
Tipsy allows easy reference of a bunch of different services and models used within itself using Dependency Injection.
For a list of all available services, see Services.
$tipsy->router()
->when('user/:id', function($Params, $Scope, $View) {
$Scope->user = $Params->id;
$View->display('home');
});
// Define the User
$tipsy->service('User', [
sup => function() {
return 'Sup '.$this->user;
}
]);
// Set the route
$tipsy->router()
->when('user', function($User) {
echo $User->sup();
});
- 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