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