The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

Modular development with Slim Framework

maxime.alayeddine's Avatar


26 Jun, 2012 06:11 PM

Hi there,

I just discovered your framework, and it seems pretty good.

I used to work with Play ! Framework 2.0 for its REST architecture.
I'm working on a project based on a lot of modules, that people can load on demand.

Usually, each module has its own folder, and was launched as a Play ! 2.0 server, so each module were independent, but still able to communicate if necessary.

Is that still possible with your framework ?
Can I keep the architecture with one folder per module, with each module calling the same Slim.php file, and then using $modulename = new Slim() without any risk of interference ?

And by the way, do you have any benchmarks ? (in order to compare its performances with Play 2.0)

Thank you !

  1. Support Staff 1 Posted by Andrew Smith on 27 Jun, 2012 08:43 AM

    Andrew Smith's Avatar

    This is indeed possible, you can call a new Slim instance for each module as you have done, just know that none of the properties will be shared across the modules. If you need to share properties you might need to extend the Slim class and add in some property sharing mechanism.

    As for benchmark, I personally haven't done any but Brian Nesbitt might have done some, he also uses Play Framework.

  2. Support Staff 2 Posted by Brian Nesbitt on 27 Jun, 2012 12:52 PM

    Brian Nesbitt's Avatar

    Modules and plugins were always misunderstood in play. I think you are talking about real modules like running separate apps but I don't think they ran separate play servers, its just how the routing propagated. I wrote a play plugin (module) for mimicking the accesslog

    I did benchmark the play framework 1.2.3 vs 2.0 beta. You can see the results here:

    The beta was responding with 3000 requests/sec and 99% within 5 ms. I don't think you are going to see that type of performance with anything PHP. Then again if the decision was only performance based you might be writing a website in C. As I have said before on this forum: "Just benchmark it and see if its "fast enough" for you for your project. Generally its other parts that are slower rather than the "simple" routing framework."

  3. 3 Posted by maxime.alayeddi... on 27 Jun, 2012 12:58 PM

    maxime.alayeddine's Avatar

    Thank you for your quick answers.

    I'll stay on Play in that case.

    However, for Brian, we did actually separate the modules in different Play servers. That takes a hell of memory, but we found it easier to manage collaborative development.

    Would you recommend anyway to make only one server and use appropriates routes ?

  4. Support Staff 4 Posted by Brian Nesbitt on 29 Jun, 2012 06:18 PM

    Brian Nesbitt's Avatar

    Can't see why separate servers would help? A typical process would see each developer have their own setup and pushing their code to the repo. Then have a build process that would go and compile/test/deploy to a dev/qa/stage/production or whatever your environments are called.

    Quickly looking at Play 2.0 modules they are very different than 1.X modules so I am really not sure and haven't done much with Play 2 since the initial beta.

  5. 5 Posted by maxime.alayeddi... on 29 Jun, 2012 06:24 PM

    maxime.alayeddine's Avatar

    Okay, thank you both for your information and your help !

  6. Brian Nesbitt closed this discussion on 30 Jun, 2012 12:51 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac