Skip to content

aminin/sfServiceLocatorPlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sfServiceLocatorPlugin

The sfServiceLocatorPlugin wraps the dependency injection component for Symfony1

Installation

  • Install the plugin

    $ git submodule add https://github.com/aminin/sfServiceLocatorPlugin.git
    $ git submodule update --init --recursive
    
  • Clear the cache

    $ symfony cc
    
  • Activate the plugin in the config/ProjectConfiguration.class.php:

    [php]
    class ProjectConfiguration extends sfProjectConfiguration
    {
      public function setup()
      {
        $this->enablePlugins(array(
          /* ... */
          'sfServiceLocatorPlugin',
        ));
      }
    }
    

Documentation

Use services in your application

The plugin adds two methods to your ProjectConfiguration and your actions, to ease the usage.

  • getServiceContainer()
  • getService()

Example:

[php]
public function executeIndex(sfWebRequest $request)
{
  $sc   = $this->getServiceContainer();
  $mail = $sc->mail;
  // or
  $mail = $this->getService('mail');
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages