Home Getting started Features

PHPMEF - PHP Managed Extensibility Framework

PHPMEF is a PHP port of the .NET Managed Extensibility Framework, allowing easy composition and extensibility in an application using the Inversion of Control principle and 2 easy keywords: @export and @import.

PHPMEF - PHP Managed Extensibility Framework

Downloads

Latest stable release: PHPMEF 0.1.0
Snapshot: http://www.codeplex.com/PHPMEF/SourceControl/ListDownloadableCommits.aspx

Hello, PHPMEF!

Here's a simple example on how PHPMEF can be used:

class HelloWorld {
    /**
     * @import-many MessageToSay
     */
    public $Messages;

    public function sayIt() {
        echo implode(', ', $this->Messages);
    }
}

class Hello {
    /**
     * @export MessageToSay
     */
    public $HelloMessage = 'Hello';
}

class World {
    /**
     * @export MessageToSay
     */
    public $WorldMessage = 'World!';
}

$helloWorld = new HelloWorld();

$compositionInitializer = new MEF_CompositionInitializer(new MEF_Container_Default());
$compositionInitializer->satisfyImports($helloWorld);

$helloWorld->sayIt(); // Hello, World!

More?

More information can be found in the Getting started manual as well as the Features page.

Last edited Jan 22, 2010 at 10:50 AM by maartenba, version 12