Tim
Tim

Reputation: 8606

How to implement a deployment-specific pluggable architecture in a single code base

I know this is somewhat subjective, but Symfony being as it is there must be a feature specifically designed for this purpose.

Here are the main factors of what I need to do:

My current thinking involves a custom bundle for every customer - hooking into them using custom Symfony events, fired from the common parts of the system. But ...

Symfony bundles aren't designed to be dynamically registered. They're baked into our core system so I can't switch them on and off for individual customers without forking/splitting the codebase. This means not only a bloated Kernel, but also events would be received by all bundles in all deployments.

I can get around that last point by namespacing the events with a configuration parameter. Even if I can live with redundant bundles in the Kernel, this whole approach seems too hard to be correct.

What is the proper way to support a "pluggable" architecture than I can hook into from the core system without splitting my codebase?

Upvotes: 2

Views: 142

Answers (1)

Oscar Gala
Oscar Gala

Reputation: 42

I use multiple app-directories. Then you can turn on/off bundles for each client since each client has it's own AppKernel.php and then you can create a separate /web/app.php for each client and point it to the currect app-directory.

You can then use mod-rewrite in Apache to point each client's subdomain or something to the right app.php file

Upvotes: 1

Related Questions