This tutorial has a new version, check it out!

Welcome to Symfony!

Video not working?

It looks like your browser may not support the H264 codec. If you're using Linux, try a different browser or try installing the gstreamer0.10-ffmpeg gstreamer0.10-plugins-good packages.

Thanks! This saves us from needing to use Flash or encode videos in multiple formats. And that let's us get back to making more videos :). But as always, please feel free to message us.

Go Deeper!

This tutorial has been upgraded! Check out the Symfony 3 Tutorial.

PHP has been on a wild ride over the past few years, with new things like namespaces, our package manager called Composer, and whole lot more sharing and friendship between projects. And in a lot of ways, Symfony has been in the driver's seat for all of that. So congrats on making it here: you're on a path to building great applications.

Let's look at some facts:

Symfony is a component library

This means that you can use any part of it in any PHP project, even that ugly legacy app they make you work. We could use Symfony's Router component to give it flexible URLs. Oh, and a lot of other projects use parts of Symfony, like Drupal, Laravel

Symfony is also a "framework"

And because we don't have time to worry about putting a bunch of libraries together, we have the Symfony framework. This is a "suggestion" of how everything can work together in a consistent system. We'll be using the Symfony framework in this course.

Silex is another framework built on Symfony and its goal is to be tiny & really easy to use.

I know what you're wondering: should I use the Symfony framework or this Silex guy? Use them both. Because they both use the same pieces, when you're done with this course, you'll be a certifiable Silex expert.

Symfony plays nice with others

Yep, Symfony tries to be as boring as possible by following widely-used standards. This makes it effortless to include and use other libraries in your project. Want to use a component of Zend Framework? We can do that with just a little bit of configuration.

Symfony is one of the top 3 most watched PHP projects on GitHub

Clearly, you won't be lonely! There's a lot of us out there working with it.

Build Something

In this course, we're going to kick off your Symfony journey by building an events application. To sweeten the deal, you'll also be mastering the most important concepts used across all frameworks and web apps in general, because Symfony steals from, ahem, builds off of the shoulders of other giants.

So even if you don't want to, when you're building something in Symfony, you'll be learning best-practices and probably becoming a better developer. You've been warned!

In this course, we've got some big goals:

  1. Start a new project using Symfony2.
  2. Explore the core areas, like routing, controllers, requests, responses and templating.
  3. Get comfortable with a few extra tools, like Doctrine for dealing with the database and code generation tools.
  4. And the real reason you are here, to learn enough best practices and tips to impress your friends at a party.

Ready? Let's go!

Leave a comment!

What PHP libraries does this tutorial use?

// composer.json
{
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "~2.4", // v2.4.2
        "doctrine/orm": "~2.2,>=2.2.3", // v2.4.2
        "doctrine/doctrine-bundle": "~1.2", // v1.2.0
        "twig/extensions": "~1.0", // v1.0.1
        "symfony/assetic-bundle": "~2.3", // v2.3.0
        "symfony/swiftmailer-bundle": "~2.3", // v2.3.5
        "symfony/monolog-bundle": "~2.4", // v2.5.0
        "sensio/distribution-bundle": "~2.3", // v2.3.4
        "sensio/framework-extra-bundle": "~3.0", // v3.0.0
        "sensio/generator-bundle": "~2.3", // v2.3.4
        "incenteev/composer-parameter-handler": "~2.0", // v2.1.0
        "doctrine/doctrine-fixtures-bundle": "~2.2.0" // v2.2.0
    }
}