in Back to PHP

My Way to PHP: Day 25 of 75

Ok, just published yesterday’s post. Today, I’m starting the best practices book.


  • Bundles should be able to reuse, i.e. own business logic most likely gets into an AppBundle.
  • For constant values use const and not the config files
  • For Doctrine use Annotations
  • Use annotations from the FrameworkBundle to handle caching, routing and security in your controllers

That’s pretty neat. I didn’t know Symfony had this. In other frameworks I worked with in Python or Clojure that’s the standard way of doing it.

  • Put templates in app/Resources/views/
  • Define forms as PHP classes
  • Use the @Security annotation for authorization
  • Use hardcoded URLs for tests to check for changing URLs

Updates Goals:

  • Learn Symfony2
  • Learn a bit more about MySQL
  • Write at least one web app using Symfony2 and its core components (templating, testing, forms, validation, security)
  • Watch one video per day on average

Progress status

Done

  • Read Symfony Best practices

In Progress

  • Watch one video per day on average [53 of 75]

Write a Comment

Comment