Ding: Dependency Injection in your PHP ApplicationsTweet
The name "Ding" comes from the action of using/doing dependency injection (DI), the result is something like "di'ing".
Also, Ding is based on (and tries to be designed as) the Spring framework from SpringSource, which offers a lot of great features not available to the php world. You now know where those great ideas came from ;) Ding also supports some of the JSR-250 and JSR-330 annotations, like @Configuration, @Bean, @Required, @Resource, etc.
Ding is intended to be used not only for web applications, but for desktop and embedded applications too. As a matter of fact, it has more features for desktop, server, and embedded applications than for web applications.
Where to find
You can find Ding:
- Github: https://github.com/marcelog/Ding
- Packagist: http://packagist.org/packages/marcelog/ding/
- Ohloh: https://www.ohloh.net/p/Ding
- Freshmeat: http://freshmeat.net/projects/ding-2
- Binpress: http://www.binpress.com/app/ding/70
1.6.3 (If you are updating from 1.1.x please see README.1.3.x before upgrading to be sure about how it might affect you).
- Scalable architecture, allowing to easily adopt new features.
- Supports XML, YAML, and annotations as bean definitions providers.
- Lightweight, easy of use, and useful.
- Loosed-couple, just use what you need and nothing more.
- JSR-250: @PostConstruct, @PreDestroy, @Resouce
- JSR-330: @Named, @Inject, @Singleton
- Spring specific: @Configuration, @Primary, @Value, @Scope, @Component, @Aspect, @Required, @Bean, @Controller, @RequestMapping
- Own specific: @Prototype, @InitMethod, @DestroyMethod, @ListensOn, @MethodInterceptor, @ExceptionInterceptor
- Aware interfaces: IContainerAware, IMessageSourceAware, IResourceLoaderAware, IBeanNameAware, IAspectManagerAware, ILoggerAware
- Bean inheritance through normal OOP or xml/yaml declarations.
- Bean aliasing for xml, yaml, and annotations.
- Extensions in the lifecycle: AfterDefinition, BeforeCreate, AfterCreate, BeforeAssemble, AfterAssemble
- Extensions for providing your own definitions: IBeanDefinitionProvider, IAspectProvider, IPointcutProvider
- Resources through php streams.
- Setter Injection (For arrays, scalar values, php code, and references to other beans).
- Constructor Injection (For the same data types as above).
- Method Injection (So you can have dependencies in singletons that must be created on demand).
- Can define factory beans, factory classes, and factory methods to create beans.
- Managed bean lifecycle (for singletons and prototypes).
- Initialization and destruction methods called by the container.
- Aspects (as in aspect oriented programming), for xml, yaml, and annotation drivers.
- Lightweight implementation of the MVC (Model View Controller) pattern. Can be used with or without Twig, and Smarty
- Annotations used by helpers and the container (i.e: @InitMethod, @DestroyMethod, @Controller, etc).
- Can cache proxies and bean definitions with Zend_Cache, Memcached, Filesystem, and APC.
- Integration with PAMI and PAGI. So you can make asterisk (telephony) applications via agi and ami.
- Helpers: Syslog, TCPServer, TCPClient, etc.
- Error Handling, Signal Handling, Shutdown Handling, all via events.
See the README file for more information.
Also, you might want to look at "Create VoIP applications for Asterisk using PHP, PAMI, and Ding" for a complete application example.
Ding is the winner of the 2011 Binpress programming contest :) Read more here.