The Symfony Micro-Framework

So you love microframeworks like Silex. Yep - me too. Being able to create a single file and immediately code up some routes is awesome.

But Symfony is a big framework, right? Wrong! Symfony can be as small as a single file!

In this tutorial, we'll bootstrap a project using Symfony as a micro-framework: something that looks more like Silex, but with the tools you're used to. This means:

  • Small: A project structure with very few files
  • Simple: Create pages by touching one file
  • Familiar: It's still Symfony :)
  • Powerful: Enable/disable any bundles you need
  • Evolve: Grow from micro to full-sized as your app succeeds

So if your next project is perfect for a micro-framework, you can still use Symfony.

Oh, and thanks to Benjamin Eberlei for his blog post and work - Symfony All The Things (Web) that served as motivation.


Your Guides

Ryan Weaver Leanna Pelham

Questions? Conversation?

  • 2015-12-08 weaverryan

    Ha yes, you understand it perfectly :). Cheers!

  • 2015-12-08 Juan Luis Garcia

    No problem, I know your were in SymfonyCon =), good slides!!
    As it will be as Silex, when our app grow ... we need to configure it.

    Thanks for you reply.
    greetins!

  • 2015-12-08 weaverryan

    Hey Juan!

    Sorry for the late reply - SymfonyCon key me busy last week :). Symfony 2.8 comes with the MicroKernelTrait (obviously), but there is no official starting "project" (like the Symfony Standard Edition) that uses the MicroKernelTrait out of the box. I assume that some community member will probably support this. I don't know if there will ever be an official version, as it's sometimes difficult if you give people (especially beginners) too many options :). Here is an example starting project using it: https://github.com/CawaKharkov...

    To include Doctrine ORM, what you would need to do is:

    1) Add DoctrineBundle to your kernel
    2) Configure it. That basically means, somehow include the normal "doctrine" config.yml configuration in your project.
    3) Have a bundle. On this project, I never include a bundle. But, it's much easier to use Doctrine if you have an AppBundle :).

    Cheers!

  • 2015-12-02 Juan Luis Garcia

    Hello, Ryan!
    A dude.., the version of symfony 2.8 that comes with the option of micro-framework that is like this?

    This ready to use or you have to shape it as in this tutorial?

    Another question, if I want to put here ORM doctrine, as you would?

    Thank you

    Greetins