Get support for mnapoli/framework-interop

If you're new to LTH, please see our FAQ for more information on what it is we do.

Support Options

Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:

View Open Issues

Take a look to see if anyone else has experienced the same issue as you and if they managed to solve it.

Open an Issue

Make sure to read any relevant guidelines for opening issues on this repo before posting a new issue.

Sponsor directly

Check out the page and see if there are any options to sponsor this project or it's developers directly.

mnapoli/framework-interop

This is an example of interoperability between frameworks through framework-agnostic modules.

composer install
php -S localhost:8000 -t web

What?

This is one application composed of 3 modules, each one using a different framework:

  • the front-end module is running on Silex (/)
  • the blog module is running on Symfony 2 (/blog)
  • the back-office module is running on Zend Framework 1 (/admin)

How it works

A module can provide one or more of the followings:

  • a DI container
  • an HTTP application
  • a CLI application

When the application is constructed, it will build a root DI container to which all the module's containers will be chained.

Then, HTTP/CLI applications can be built using the root container (not the module's container), which allows to access all the entries of all the container's.

How to write a module

You start by writing a class that extends Interop\Framework\Module:

namespace Acme\BlogModule;

class BlogModule extends Module
{
    public function getName()
    {
        return 'blog';
    }

    /**
     * You can return a container if the module provides one.
     *
     * It will be chained to the application's root container.
     *
     * @return ContainerInterface|null
     */
    public function getContainer()
    {
        return null;
    }

    /**
     * You can return an HTTP application if the module provides one.
     *
     * @return HttpKernelInterface|null
     */
    public function getHttpApplication()
    {
        return new HttpApplication();
    }
}

HTTP applications can be any class implementing Symfony's HttpKernelInterface.

Containers can be any class implementing Interop\Container\ContainerInterface.

Our Mission

We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.

Interesting Articles

Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated

p-e622a1a2