Your SlideShare is downloading. ×

Symfony

630

Published on

PHP framework overview

PHP framework overview

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
630
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Rewrites globals to be testable
  • Binds Request and Response together
  • For legacy applications
  • Transcript

    • 1. SYMFONY 2 FRAMEWORK INTRODUCTION Artjom Kurapov 5th April of 2013
    • 2. Major PHP frameworks  Zend  Symfony 1  2  Code igniter  Kohana  CakePHP  Yii 2
    • 3. Motivation  Singleton  Tight coupling  Untestable  Premature optimized  Indescriptive names  Duplication  Single responsibility  Open for extension, Closed for modification  LSP http://phpmaster.com/liskov-substitution-principle/  Interface segregation  Dependency inversion
    • 4. Functional vs fast http://docs.phalconphp.com/en/latest/reference/benchmark/hello-world.html
    • 5. Used with  Similar to Zend - a collection of components, which can be a full-stack framework  Drupal 8 is using only some of the components  eZ Publish 5 is using a full-stack  PHPUnit, Propel, Doctrine - use Yaml, Console  composer = package & dependency manager  PSR-0..3 standards affect autoloading
    • 6. COMPONENTS As seen on the web
    • 7. Components & Drupal 8
    • 8. HttpFoundation Request
    • 9. HttpFoundation Response
    • 10. HttpFoundation Session
    • 11. HttpKernel
    • 12. Custom HttpKernel
    • 13. FULL STACK
    • 14. Setup  Download or install with composer: composer create-project symfony/framework-standard-edition symfony/ 2.2.0  Check for directory permissions & requirements php ./app/check.php  Open it in browser, get a 20mb wow effect http://localhost/symfony/web/app_dev.php/
    • 15. Still, awesome profiler
    • 16. Stylish error reports
    • 17. Directory structure (Confusingasalways) appenvironmentconfiguration cache config logs bin src ourapplicationcode Exove CalendarBundle Controller Resourcesviews,css,imagesgohere vendor externallibraries,usuallyincompany/projectstructure symfony doctrine twig web publicwillseeonlythispart
    • 18. IDE support
    • 19. High-level request flow
    • 20. Low-level request flow  Frontend bootstrap (web/app_dev.php) adds autoloader, boots kernel, creates Request  Kernel loads config, resolves URLto controller  Controller loads model & view, can make a subrequest and returns a Response  Views usually use twig  Models usually use doctrine
    • 21. Routing with YAML  app/config/routing.yaml
    • 22. Routing with PHP
    • 23. Routing with annotations
    • 24. Routing - URL generation AlsoaccessibleinviewsifyouuseTwig:
    • 25. Controller You don’t have toinherit base Controller
    • 26. VIEW
    • 27. Controller + direct View
    • 28. Controller + View @Template uses Controller name to figure out template path.. src/Exove/DemoBundle/Resources/views/Demo/hello.html.twig
    • 29. Twig - variables
    • 30. Twig - inheritance
    • 31. Assetic - resource links Might not be a good idea if you use custom less / require.js
    • 32. DATABASE
    • 33. Doctrine  ORM - different headache (due to abstraction)  multiple db engine support  Mostly, no direct SQLs, instead - chaining  Alternative - DoctrineQL  Migration support  app/config/parameters.yml
    • 34. Doctrine chained select
    • 35. Entity An abstract object that gets extended with saving, retrieving, searching interfaces… It should not know how it is used or stored
    • 36. Annotation type mapping
    • 37. Getter/Setter generation
    • 38. Schema generation
    • 39. Controller + Model
    • 40. DoctrineMigrationsBundle
    • 41. Testing  Config@app/config/config_test.yml  Filesinsrc/*/*/Bundle/Tests  abstractclassWebTestCaseextendsPHPUnit_Framework_TestCase
    • 42. Conclusion  Heavy and extensive  Twig / Doctrine  Functional with growing community

    ×