Your SlideShare is downloading. ×
Symfony 2 Best Practices
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Symfony 2 Best Practices

2,386
views

Published on

This is my slide for Drupal 8 Meetup. The practices are collected from my working and managing experience on Symfony 2 throughout my projects.

This is my slide for Drupal 8 Meetup. The practices are collected from my working and managing experience on Symfony 2 throughout my projects.

Published in: Technology

0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,386
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
36
Comments
0
Likes
6
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

Transcript

  • 1. Symfony 2 Best Practices Speaker: Bao Nguyen bao.nguyen@semantics.vn 10/13/2013
  • 2. 10/13/2013
  • 3. Why Symfony 2.3? Why best practices? 10/13/2013
  • 4. Code Standard • PSR-0, PSR-1, PSR-2 • Bundle Structure Best Practices • Bundle namespace: • SmvnSomeCoolBundle • SmvnBundleSomeCoolBundle • SmvnBundleSmvnSomeCoolBundle • Service naming, Route naming • Prefix with bundle name and vendor name (for reusable bundle) • Use service alias (image_resizer vs. smvn_image_resizer) 10/13/2013
  • 5. Only commit your own code • • • • • • • • • • • /.idea /nbproject /composer.phar /vendor /app/config/parameters.yml /app/cache /app/logs /app/phpunit.xml *.php~ /web/bundles /web/uploads 10/13/2013
  • 6. Tools • Manage Assets (js+css) with Assetic • Sensio Framework Extra • Security Component (Firewall, Users, ACL …) • Twig • Doctrine Extension • Console component • PHPUnit / Behat • Configuration system (DI & Parameters) • Jenkins Jobs for PHP (http://jenkins-php.org/) 10/13/2013
  • 7. Reusability • Template inheritance • Template macro • Twig Extension • Base Controller / Embed Controller • Service • Form Type • Bundle (try knpbundles.com) • Extract bundle from project for reusability 10/13/2013
  • 8. Pitfall • Security Context: isGranted() vs. hasRole() • Event Listener vs. Event Subscriber • Doctrine Schema Update vs. Doctrine Schema Migration • app/cache, app/logs write-permission: Never use umask • Nesting limit in xdebug • Case sensitive Annotation name (@Entity vs @entity) • Avoid using dev-master in composer.json • Update vendor  Clear cache  Clear Assetics  Update schema 10/13/2013
  • 9. Thank you for listening! bao.nguyen@semantics.vn 10/13/2013

×