Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine
This tutorial has a new version, check it out!

Starting in Symfony2: Course 1 (2.4+)

1:18:05

What you'll be learning

// 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
    }
}

Get your first Symfony2 project off on the right foot, with the right tools, best practices and tips. If you're serious about getting into Symfony2, this course is for you!

In this screencast, we start building a real events application from the ground-up, touching on and discussing the most fundamental parts of the application. Specifically, we'll cover:

  • Installation, Git and Setup
  • Composer
  • Routing
  • Controllers
  • Introduction to the service container
  • Twig
  • Doctrine
  • Server setup
  • Code generation
  • Fixtures & external libraries
  • And other tips and tricks

Your Guides

Ryan Weaver Leanna Pelham

Buy Access

Join the Conversation?

157
Login or Register to join the conversation
Default user avatar
Default user avatar m0j0_j0j0 | posted 4 years ago

From the free videos i have seen, these screencasts are awesome!

The only complaint i have is that it feels a little too presentation-ish and edited. Probably due to the fact that the person speaking is different from the person writing the code. So we are missing out on the pace, subtleties, side tips and segways, human errors, fixes etc.

Anyway, you guys are the only ones making comprehensive symfony screencasts so keep up the good work!

5 Reply

Hi m0j0_j0j0!

Thanks for the comment, it's helpful to know what people are thinking, and especially your thoughts about it being too presentation-ish. Perhaps we'll experiment in the future with some different formats and see how they feel. When we do, I'd love your feedback :).

Cheers!

3 Reply
Default user avatar

Waiting for next lessons in Sf2.1.

Thank you.

1 Reply
Default user avatar
Default user avatar KnpUniversity | enkuso | posted 4 years ago

Good news! Episode 2 is now available :)

Reply
Default user avatar
Default user avatar kamedan | posted 4 years ago

i can't buy it :p

1 Reply
Default user avatar
Default user avatar KnpUniversity | kamedan | posted 4 years ago

Hi Kamedan - what kind of issue are you seeing? Feel free to use the contact us page to send us more details :)

Reply
Edison V. Avatar
Edison V. Avatar Edison V. | posted 4 years ago

Hey Lucas,I had the same problem...if you guys someday found out how to setup vhost for windows 8, just let please everybody know...I will do the same for sure.
Meanwhile let's go to the second screencast! Love the frst one, good job!

1 Reply
Default user avatar
Default user avatar mikiplus | posted 4 years ago

for god sake, it's "Chewbacca"!

1 Reply

My god, embarrassing! Thanks for the tip - I've fixed this (https://github.com/knpunive... and gotten it deployed right away!

Cheers!

1 Reply
Default user avatar
Default user avatar Tim Whitehead | posted 4 years ago

Love the screencasts! Will you offer additional formats along with .mov?

Reply

Hey Tim! What other format are you looking for? :)

3 Reply
Default user avatar

I find that the .flv at 480p files that I download from some youtube screencasts have been the most bandwidth/size friendly. It would be nice to have that as a download option.

1 Reply
Default user avatar
Default user avatar Felippe | posted 4 years ago

completely new with composer, when running install I get this, while in the process of cloning doctrine/common (2.3.x-dev bb0aebb) :

[Symfony\Component\Process\Exception\RuntimeException]
The process timed out.

any suggestions on how I could circumvent this issue?

aside from downloading the without vendors tarball and running install inside it which, oddly, went about smoothly installing the vendors

Reply
Default user avatar
Default user avatar Дмитрий Кабардинов | posted 4 years ago

Sorry, I can't get it. Is it 12$ for the whole course, or 12$ per episode?

Reply

Hi Дмитрий! It is $12 per episode - except for episode 4 which is $4 if you buy the entire series. Hope that helps!

Reply
Default user avatar

Are you going to make more videos for 2.4+? Something more in-depth than the beginner setup. For instance real world uses and projects created using Symfony 2.4?

Reply

Definitely - we're trying to do about one a month - so episode 2 is up next! Not a lot has changed really, so if you go through the tutorials now, you'll already be in great shape.

Cheers!

Reply
Default user avatar

If I get the 2.2. version do I still need to pay another 12 dollars for the 2.4?

Reply

Absolutely not :) - if you buy the 2.2 version, you'll get the 2.4 version for free when it comes out. We'll even email you to let you know it's ready.

Cheers!

Reply
Default user avatar
Default user avatar iair linker | posted 4 years ago

I just purchased the
Starting in Symfony2: Episode 1 (2.2) Tutorial
and is not working the download and the watch option, so i can not see wath i just bought!! how can i see the video????

Reply

Hi @iair linker

All the links are working again now! We deployed a big release to the site on Fri and some of the videos were temporarily unavailable. But all should be well - sorry about any inconvenience and please let me know if oyu have any other issues!

Cheers!

Reply
Default user avatar

Had the same problem. Removing this code also worked for me, but is this the only way to fix this?

Reply

Hi guys!

I'm not sure why this bit of code would be affecting the stylesheets, but I've just pushed a small update that will hopefully clarify where the code should go and its purpose: https://github.com/knpunive...

Since this code just prints out some things, it *shouldn't* affect stylesheets. But let me know if you're having issues, we'll find out why, and update things to make sure nobody else has the same problem.

Thanks!

Reply
Default user avatar

I think it's the cache. I didn't remove that part of the code, instead I just modified the index.html.twig file and it worked. I made sure it was using the template by changing the code where it points to index.html.twig (and it gave an error saying not found because i changed it to index1.html.twig) then I just modified it (the twig file) and it just started working.

Reply

Interesting - it does make sense based on the reports, though normally the template cache isn't a problem. I've opened up an issue to check into it further: https://github.com/knpunive.... If you have any extra details you want to add, it's much appreciated.

Thanks again!

Reply
Default user avatar
Default user avatar Mathias Strasser | posted 4 years ago

Hi,

I follow the tutorial and I think there's a small mistake in the PDF provided.
On page 13 (Twig part) the first part called "Template name and path examples" you propose EventController instead of EventBundle, I think.

Reply

Hi Mathias Strasser!

Yes, you're absolutely right! I've fixed it here: https://github.com/knpunive...

Thanks so much for letting us know!

1 Reply
Default user avatar
Default user avatar Mathias Strasser | posted 4 years ago

Hi again,

In your chapter "Fixtures and External Libraries", apparently, now this command:
php composer.phar update doctrine-fixtures-bundle

We have this message:
Package "doctrine-fixtures-bundle" listed for update is not installed. Ignoring.

We need to write the complete name of package:
php composer.phar update doctrine/doctrine-fixtures-bundle

(http://getcomposer.org/doc/... )

Reply

Hi Mathias Strasser!

Thanks again! At one point, the composer update syntax was "fuzzy" - meaning you could say "doctrine" and it would update all libraries that had "doctrine" in their names. However, it was never documented, so it may have been a feature that was on accident :). I've opened up and already fixed the issue - you can see it at https://github.com/knpunive....

Thanks so much again for the report! If you find more, you can comment here or open an issue on GitHub.

Thanks!

1 Reply
Default user avatar
Default user avatar Scott Lively | posted 4 years ago

Ryan, the comment in the code sample under routing should say # app/config/routing.yml not # app/config/config.yml

Reply

Hey Scott!

You're absolutely right - thanks for the tip! I've fixed it and pushed the update.

Thanks!

Reply
Default user avatar

I would consider purchasing this, but I feel the screencasts on installation / configuration (readily available *everywhere*) are not sufficient for me to decide that the rest of the course is worthwhile. I would have, at least, wanted the next one included in the trial.

Reply

Hi J7mbo!

That makes sense :). To get some more details, you can also go to the other chapters in the course and read-through the scripts, which are available right on the page. Hopefully that will give you a better idea of what the things we're going through for the rest of the course :).

Cheers!

Reply
Default user avatar
Default user avatar James Mallison | weaverryan | posted 4 years ago

Sounds good - when is the next 2.2 course being released? Trying to gauge how long I'll have to wait for the next ones (particularly 2.3) before committing :)

Reply

We should get episodes 3 and 4 for 2.2 out in the next few weeks. It's very minor changes though - we'll just make sure code work and highlight any new changes. Fortunately, Symfony keeps backwards compatibility quite well :).

Thanks for your interest!

1 Reply
Default user avatar
Default user avatar Ángel Manuel Marqués Ruiz | posted 4 years ago

At 1:09:50 after deleting the event route I ran into some troubles.

When I go to /event/new Symfony is telling me that there is no route "event".

An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "event" as such route does not exist.") in EventBundle:Event:new.html.twig at line 6.

So my question is how to change this line:
< a class="link" href="{{ path('event') }}">← back to the event list< / a >

... so that I can get the desired result.

Reply
Default user avatar

I posted the same problem ... and found a solution 5 min. after having posted ..

I just gave the annotation route in the Default-Controller a name, the lines look like this now:

/**
* Lists all Event entities.
*
* @Template()
* @Route("/", name="event")
*/

i don't know if that's the right solution, but it did the trick for me.

Now, only the edit-page is complaining about an redundant Body-Block, but that should be easy to remove.. ;)

Edit: the body-error was my mistake... had hit a key by accident...

Reply

Hi guys!

Yes, the solution by taZign is perfect! When we moved the route into annotation, we didn't give it a name by default. It was originally named `event`, which is the root key in routing.yml for that route. On line 6 of new.html.twig, we're referencing it by that name. The solution is to make sure that our new route is called `event` (which the above code accomplishes). This is definitely an error in the screencast - and the solution is to fix the route so that it's called "event" - the template itself shouldn't need to change.

We'll update this little bit for the next time we update the screencast. Thanks for the questions and solutions!

Reply

Hi guys!

I've also just updated the script on this page and the code download with the changes.

Cheers!

Reply
Default user avatar

Thanks for the fast reaction!

The only thing i now have to find out is why the asset_url gives the wrong path to my stylesheets in prod-env.

with app_dev.php all images and styles are applied.

with app.php only naked HTML, since the path points directly to the web-directory without including the bundle-name...

probably my mistake...

Edit: And once again me :)
php app/console assetic:dump --env=prod --no-debug

... and everything is working fine in app.php :)

Reply
Default user avatar
Default user avatar Mark Fox | posted 4 years ago

I should have started learning Symfony via this screencast. I'd recommend spending a couple of days going through the symfony.com book, but then jump over to this screencast series. The content and production are top notch.

Reply
Default user avatar
Default user avatar John Marcus Mckay | posted 4 years ago

Purchased this earlier today and am working through it now, it is really well done, will be buying the others, thanks very much :)

Reply
Default user avatar
Default user avatar sherif sabry | posted 4 years ago

Are you planning on upgrading the videos to the current LTS symfony 2.3 release?

Reply

Hi sherif sabry!

Yes, we definitely will be updating them shortly! BUT, the good news is that nothing has really changed. Symfony has added some really nice features (which you can read more about here: http://symfony.com/blog/cat..., but for things that have changed, backwards compatibility is typically being kept until Symfony 3.0. That means that everything you're learning here is still up to date and should continue working :). When we update for each version, we verify that things are still working correctly and add any notes needed so that you're aware of any changes or new, alternative ways of doing things.

So, if you want to learn Symfony, there's no reason to wait :).

Cheers!

Reply
Default user avatar

I created a few batch files and saved them to a gist https://gist.github.com/tvl... . This makes it easier to do the asset dump (because we can't use the alias' in windows) and update the schema and update the fixtures. These do everything for test/dev and dev/prod where required. They are very simple but I find them helpful because it's less typing when those have to be done a lot.

I found that it is easier to drop the db and then update the schema for ms sql server 2012. There are a lot of errors that get thrown when I don't drop the tables first.

Reply
Default user avatar
Default user avatar Sargath | posted 4 years ago

Fantastic screencasts looking forward for more like for some commerce/cart , cms examples best building practices and etc . thx a lot !! :)

Reply
Default user avatar
Default user avatar Sargath | posted 4 years ago

Btw plz move all Symfony screenasts to Symfony tag / sub page , that they all reside in /screencast/tag/symfony it would be better to navigate through them. thx

Reply

@Sargath Done! Thanks for pointing that out :)

Reply
Default user avatar

I am not sure if anyone experienced this, but for some reason, the style sheets are not applied to my index page. Frustrating part is it is taking the default index page which has been overwritten by the new html. Yes, I deleted the cache! show, edit pages are looking good with the css.

Reply
Cat in space

"Houston: no signs of life"
Start the conversation!