4

Symfony2 is handling all its things in bundles in /app or in /vendor. This is fine if you are handling and managing all by yourself or Ops that handle all needed things.

But I haven't found a good way for some kind of 'plugin system' in SF2 till now. I have tried to find an answer for several days now on the net but didn't catch an answer. Maybe I just googled it the wrong way. For example, you are writing an application (a simple core) that may have some kind of app store, where you can buy additional plugins (an extension, bundle, whatever you may call this). The customer activates it and should start with it. This should be regardless if it is hosted on my machine (SaaS) or self-hosted by a customer's server.

This, IMO, can't be done when you really need to download the plugin as you would need to register it in AppKernel.php. This is an action a 'normal' customer can't or better be said should not be able to do.

In Symfony speech, these plugins would be bundles, or at least should be. But how to integrate it without the need of modifying AppKernel.php?

Should the only way really be to install the whole system (core and plugins) and verify it by some kind of license code? Or scheduled license verifications to a license server?

Or is there a way to just download the 'plugin' into AppBundles folder and use it (including routing, maybe some database fixtures are needed and so on)?

Michael
  • 41
  • 6
  • `This, imo, can't be done when you really need to download the plugin as you would need to register it in AppKernel.php. This is an action a 'normal' customer can't or better said should not be able to do.` You should remember that AppKernel.php is still a PHP file. You have the full power of the language to generate a list of bundles to register; it doesn't have to be a string constant entered into the file. Offhand, you could easily just write a json config file with a list of bundles to load, and read it in from the kernel. Obviously, you should avoid database connections in there. – Sam Dufel Jun 22 '16 at 19:37
  • But by reading it via the kernel, i need to modify it and will loose the possibility to automatically update SF and/or dependencies, right? I've been thinking about Compiler passes / ContainerBuilder and register extensions via a generic bundle that is always going to get loaded. But i don't know if this is the correct approach or if i missunderstand the behaviour of this ways. Or register a bundle, that will read eg a file or database to use registerBundles() and load them. Like in http://stackoverflow.com/a/28495297/5650487 but as i said, don't know if this would be 'the right way'. – Michael Jun 23 '16 at 09:25

0 Answers0