1 / 18

PHP MVC Frameworks and Symfony

PHP MVC Frameworks and Symfony. What is MVC?. Model-View-Controller Separates: M: Data model V: Presentation (UI) C: Business logic Can change any of these three without affecting the others (in theory). Why use an MVC framework?. Avoid “reinventing the wheel” Use proven, tested code

stew
Download Presentation

PHP MVC Frameworks and Symfony

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PHP MVC Frameworksand Symfony

  2. What is MVC? • Model-View-Controller • Separates: • M: Data model • V: Presentation (UI) • C: Business logic • Can change any of these three without affecting the others (in theory)

  3. Why use an MVC framework? • Avoid “reinventing the wheel” • Use proven, tested code • Automation (ORM, generators) • Maintainability • “Plugin” functionality

  4. Flow: Traditional vs. MVC Query Controller Model Processing Output Output Query Output Processing View Final Output

  5. Popular PHP MVC Frameworks • CakePHP • Documentation is somewhat lacking • Apparently difficult for beginners • Symfony • Great documentation and community • Easy to get started • Zend • Supported by Zend (official PHP company) • More of a library than complete framework

  6. Why did we choose Symfony? • Steep learning curve, but… • Great documentation • Great community • Well-written and tested code • Nice deployment system (PEAR / SVN) • Extensive use of existing projects, instead of rewriting everything from scratch

  7. http://www.symfony-project.org

  8. Model View Controller

  9. Command line interface • Has a command line interface • Creates the basis for the module • Helps with maintenance • Easy to check if everything worked

  10. Object Relational Mapper (ORM) YAML (Used in RoR) • Propel gives database independence • Id, created_at, & foreign key fields are autogenerated

  11. Object Relational Mapper (ORM) • Database tables = classes & table rows = objects • Auto-generated based on schema

  12. Admin Generator • List, show, edit, & add • 4 pages, < 30 LOC

  13. i18n and l10n English: (LTR) Arabic: (RTL)

  14. Symfony Plugins • 100s of plugins • Easy integration • AJAX, CSS, CMS, SEO, Security, Flash, etc.

  15. Diagnose Problems • Check Execution Time • Optimize SQL Queries

  16. Should you use an MVC framework for your next project? • Are there complex hierarchical relationships in your data? • Will this project need to be maintained by more than one person for more than a year? • Do you need the ability to add advanced features like AJAX without writing the code from scratch? • Probably Yes. (unless it’s a throwaway)

  17. Which MVC Framework? • .NET (official) • Ruby on Rails • PHP • CakePHP • Symfony • Zend • Use a well-established framework with good documentation and a large community

  18. More information • Symfony Project: • http://www.symfony-project.org • Syllogistic Software: • http://www.syllogisticsoftware.com • Questions? • Contact Jason Hanley – jhanley@sylsft.com

More Related