Sfiocplugin - sfIoCPlugin - IoC container implementation for PHP and symfony

  •        151

sfIocPlugin - IoC container for Symfony frameworkDescriptionsfIocPlugin implements IoC container in PHP and provide easy integration with Symfony Framework. Plugin is inspired by Spring framework IoC container (http://www.springframework.org/), but IS NOT AN ONE-TO-ONE COPY. IoC container is useful for business logic layer implementations and adds more flexibility to your applications. FeaturesThis plugin is a very basic implementation of IoC, but it is enough for solving typical architecture problems. annotations support (easy bean configuration by annotations for classes and methods - no need for configuring all parameters in config files) support for dependency injection (currently only for construct()) implements singleton pattern (there is no need for using boring getInstance() methods) simple usage configurable with YAML files RequirementsSymfony 1.0.x or 1.1.x sfAnnotationPlugin Example /* * @Singleton / class UserLogic { /* * @Inject */ public function __construct(DataFinder $finder) { $this->finder = $finder; } public function authorize($login, $password) { $is_auth = $this->finder ->from('UserAccount') ->where('login',$login) ->where('password'=>$password) ->count() > 0; if($is_auth) { // authorize } return $is_auth; } }Bean configuration: all: # for all environments UserLogic: { class: DefaultUserLogic } DataFinder: { class: DBFinder }test: # for test environment DataFinder: { class: testFinder } # redeclare DataFinder in test env for unit testing without databaseCalling bean methods: $api = sfContext::getInstance()->get('DefaultBeanFactory')->getBean('UserLogic'); if($api->authorize('john_doe', 'secure')) { // secure stuff here }

http://code.google.com/p/sfiocplugin

Tags
Implementation
License
Platform

   




Related Projects

vim-olive - Vim Mode Line Verifier


Vim Mode Line Verifier

vim-mash - Motion Activated Search Highlighter for Vim


Motion Activated Search Highlighter for Vim

vim-grillz - Flash your wicked grillz!


Flash your wicked grillz!

vim-foist - Complete whole lines from any partial therein


Complete whole lines from any partial therein

vim-efmc - Vim Error Format Compiler


Vim Error Format Compiler


uzbl-utrs - mkng uzbl tlrbl


mkng uzbl tlrbl

toycsv - A toy CSV parser written in ruby + lexr + racc


A toy CSV parser written in ruby + lexr + racc

tiktok - TikTok provides a simple asynchronous timer object for VimL.


TikTok provides a simple asynchronous timer object for VimL.

tabby - Using Vim's Tabs the Right Way


Using Vim's Tabs the Right Way

SohiVila - GNU source-highlight Vim language


GNU source-highlight Vim language

SinTax - A DSL for generating Vim syntax highlighting files


A DSL for generating Vim syntax highlighting files

rkdots - Generate a graphviz visualisation of the given javascript statement.


Generate a graphviz visualisation of the given javascript statement.

RelNumBar - Show relativenumbers alongside normal numbers in Vim


Show relativenumbers alongside normal numbers in Vim

Punisher - Punisher hurts you where it hurts most - your time.


Punisher hurts you where it hurts most - your time.

noisy - Don't chat quietly (weechat channel noises)


Don't chat quietly (weechat channel noises)

newlisp-manual - Asciidoc version of the newLISP manual


Asciidoc version of the newLISP manual

Land-of-newLISP - Selected snippets from Land of Lisp rewritten in newLISP


Selected snippets from Land of Lisp rewritten in newLISP

Fossilise - Poor man's collaborative editing in Vim


Poor man's collaborative editing in Vim

firstly - Convert Between Numeric, Spelt, and Short & Long Ordinal Forms of Numbers


Convert Between Numeric, Spelt, and Short & Long Ordinal Forms of Numbers