An introduction to Symfony 2 for symfony 1 developers
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

An introduction to Symfony 2 for symfony 1 developers

on

  • 6,804 views

 

Statistics

Views

Total Views
6,804
Views on SlideShare
6,799
Embed Views
5

Actions

Likes
5
Downloads
67
Comments
0

1 Embed 5

http://www.linkedin.com 5

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

An introduction to Symfony 2 for symfony 1 developers Presentation Transcript

  • 1. An introduction to symfony 2 for symfony 1 developers By Giorgio Cefaro
  • 2. What is Symfony 1? Symfony is a full-stack framework, a library of cohesive classes written in PHP. It provides an architecture, components and tools for developers to build complex web applications faster. from symfony-project.com
  • 3. What is Symfony 2? “ First, Symfony2 is a reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems. Then, based on these components, Symfony2 is also a full-stack web framework.” “ I don't like MVC because that's not how the web works. Symfony2 is an HTTP framework; it is a Request/Response framework. That's the big deal. The fundamental principles of Symfony2 are centered around the HTTP specification.” from F. Potencier blog http://fabien.potencier.org/article/49/what-is-symfony2
  • 4. Directory structure
    • Symfony 1.4
    • Symfony 2
  • 5. General architectural differences
    • Symfony 1.4
      • Full stack MVC framework
      • 6. Complex controller layer
      • 7. Multi-application architecture
      • 8. Application/plugin level routing
      • 9. Code organized in applications/modules and plugins
    • Symfony 2
      • Full stack MVC decoupled components bundled in a framework, fully HTTP compliant
      • 10. Simpler Controller objects
      • 11. Single application
      • 12. Global routing
      • 13. Code organized in bundles
      • 14. A bundle is like a symfony 1 plugin
      • 15. Even Symfony 2 core components are distributed as bundles
  • 16. Controller
    • Symfony 1
      • Complex and coupled Controller Layer
      • 17. Not fully replaceable (ok, let's say heavy hacking needed!)
      • 18. “ Distributed” over applications, plugins, modules, filters...
      • 19. Dirty mix of routing patterns and straight module access
    • Symfony 2
      • A controller can be easy as a simple PHP function
      • 20. A base Controller class is supplied with several helper methods and can be used as standalone component
      • 21. No routing, no party! Access to controller actions inside bundles MUST go through routing pattern matching
  • 22. Configuration
    • Symfony 1.4
      • Configuration Cascade
      • 23. Lots of yml files (app, factories, database, security, cache, etc ) distributed through apps, plugins and modules
      • 24. You can get easily lost in a complex situation
    • Symfony 2
      • Configuration files inside blundles must be included manually from outside
      • 25. Less configuration files
      • 26. The sole config.yml is incredibly powerful
      • 27. With config.yml and routing.yml you can do almost everything :-)
  • 28. Handling Dependencies
    • Symfony 1.4
      • Dependency handling is left to the developer
      • 29. Service configuration limited to standard components
      • 30. All mixed up in factories.yml
      • 31. Non standard services if not properly handled may easily introduce coupling and poor testability
    • Symfony 2
      • Service Container
      • 32. Dependency Injection for full decoupling and high testability
      • 33. Public and private services, tags, aliases
  • 34. Handling Dependencies – mailer example
    • Symfony 1.4
    • Symfony 2
  • 35. Validation
    • Symfony 1.4
      • Embedded inside forms
      • 36. Validators are not easily reusable in other contexts (for example webservices)
    • Symfony 2
      • Validators are sticked to Entities
      • 37. Configurable via Yaml, xml, annotations or PHP
      • 38. Validators are called via the Service Container
  • 39. Validation
    • Symfony 1.4
    • Symfony 2
  • 40. Persistence - Doctrine
    • Symfony 1.4
      • Bundled with the framework as a standard (with Propel as an alternative)
      • 41. Active Record
      • 42. Design requires lot of effort to make code fully testable
    • Symfony 2
      • Totally decoupled from the framework via Service Container
      • 43. Entities are independent from OR[D]M
      • 44. Entities are mapped to DB via metadata definition (Yaml, xml, or annotations)
  • 45. Persistence - Doctrine
    • Symfony 1.4
    schema.yml
    • Symfony 2
    Product.orm.yml
  • 46. Persistence - Doctrine
    • Symfony 1
    • Symfony 2
  • 47. Cache
    • Symfony 1.4
      • Non-standard cache mechanism, though flexible and configurable
    • Symfony 2
      • Standard RFC 2616 HTTP Cache
  • 48. Testing
    • Symfony 1.4
      • Lime framework bundled as a standard, PHPUnit can be used as a plugin
      • 49. Lime is not as powerful as PHPUnit
    • Symfony 2
      • Fully integrated with PHPUnit framework
      • 50. In functional tests internal objects can be fully inspected (kernel and DI container too!)
  • 51. Should I move to Symfony 2? Yes.
  • 52. Giorgio Cefaro Twitter: @giorrrgio linkedin.com/in/giorgiocefaro