SlideShare a Scribd company logo
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
symfony
Write Plugins
Fabien Potencier
http://www.symfony-project.com/
http://www.sensiolabs.com/
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
What is a Plugin?
• Directory structure convention
•Classes
•Filters
•Mixins
•Helpers
•Configuration
•Tasks
•Modules
•Schemas
•Model Extensions
•Fixtures
•Web Assets
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
What for?
•To contribute back a symfony extension
•Another way to package your code
•To share code between projects
Portability
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Let’s build a plugin
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Plugin Creation
• Choose a name
– Choose a prefix (sf is only for Official Plugins) - Your
initials for example
– If it depends on Propel or Doctrine, add it to the prefix
– Choose a main name
– Add the « Plugin » suffix
• For our simple plugin: fpPropelSimplePlugin
• Create a folder plugins/fpPropelSimplePlugin
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Add some Web Assets
• Put assets in a web/ folder
– web/js
– web/css
– web/images
• symfony plugin-install …
– Creates a symlink on *nix
– Copies all files on Windows
in the web/fpPropelSimplePlugin folder
plugins/fpPropelSimplePlugin/web/images/test.png
>
http://localhost/fpPropelSimplePlugin/images/test.png
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Add some Model Classes
• config/schema.[xml|yml]
<database name="propel"
package="plugins.fpPropelSimplePlugin.lib.model" ...>
propel:
_attributes:
package: plugins.fpPropelSimplePlugin.lib.model
• You can have foreign keys between plugins and
the main application
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Example
sfSimpleBlogPlugin
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Add some Configuration
• Make your plugin customizable
– apps/APP/config/app.yml
– Prefix with the plugin name
– sfConfig::get(‘app_fpPropelSimplePlugin_XXX’);
• config/config.php
– Do whatever configuration you want
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Example
• sfGuardPlugin
config/config.php
apps/APP/config/app.yml
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Propel Behaviors
• sfPropelParanoidBehaviorPlugin
config/config.php
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Add some Modules
• Same structure as a « normal » module
– You can move module from your application to the
modules/ plugin folder
– But you must « enable » it in settings.yml
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Example
• sfGuardPlugin: Admin Generated modules
• sfSimpleCMSPlugin
– Actions inheritance
– Templates inheritance
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Don’t Reinvent the Wheel
• Don’t add a security mechanism
– Rely on symfony built-in credentials
– Use other plugins (sfGuardPlugin)
• Don’t add a media library
– Use sfMediaLibraryPlugin
• Don’t create yet another plugin to do client side
validation
– Try to enhance existing ones
– Contact the main author to discuss your
enhancements
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Add a LICENSE file
• Choose an Open-Source license
– MIT
– BSD
– LGPL
– GPL
– …
• Add a LICENSE file in the root folder
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Add a README file
• README structure
– Installation
– Configuration
– Customization
– Known Limitations
– Todo List
– Change Log
• Trac Wiki Format
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Package a Plugin
• A symfony Plugin package is a PEAR package
• Add a package.xml
– Name
– Description
– Summary
– Author(s)
– Version
– Stability
– Dependencies
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Publish It
• For private usage
– Host it somewhere
symfony plugin-install http://plugins.xxx.com/fpPropelSimplePlugin-1.0.0.tgz
• Host it on symfony-project.com
– Must be released under an Open-Source license
– The community helps you fix bugs and enhance it
– Fame
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
On symfony-project.com
• Create a trac account
• Create a new Wiki page named after your plugin
name
• Attach the PEAR package
• Ask Fabien for SVN access
• Spread the word… post on the mailing-list & the
forum
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Next symfony Workshops
En français : Paris, France - Dec 05, 2007
In English : Paris, France - Feb 13, 2008
More info on www.sensiolabs.com
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
Join Us
• Sensio Labs is recruiting in France
– project managers
– web developers
• You have a passion for the web?
– Web Developer : You have a minimum of 3 years experience in
web development with Open-Source projects and you wish to
participate to development of Web 2.0 sites using the best
frameworks available.
– Project Manager : You have more than 5 years experience as a
developer and/or a project manager and you want to manage
complex Web projects for prestigious clients.
Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
SENSIO S.A.
26, rue Salomon de Rothschild
92 286 Suresnes Cedex
FRANCE
Tél. : +33 1 40 99 80 80
Fax : +33 1 40 99 83 34
Contact
Fabien Potencier
fabien.potencier@sensio.com
http://www.sensiolabs.com/ http://www.symfony-project.com/

More Related Content

PDF
Development workflow with Cocktail and NME
PDF
Symfony workshop introductory slides
PDF
Symfony for non-techies
PDF
AMIMOTO: WordPress + Amazon Web Services MANILA
PDF
Tuesday plan mediateam
PDF
HTML+CSS Resources
PDF
Unit testing symfony plugins with php unit
PDF
symfony: Open-Source Enterprise Framework
Development workflow with Cocktail and NME
Symfony workshop introductory slides
Symfony for non-techies
AMIMOTO: WordPress + Amazon Web Services MANILA
Tuesday plan mediateam
HTML+CSS Resources
Unit testing symfony plugins with php unit
symfony: Open-Source Enterprise Framework

Similar to Write Plugins for symfony (Symfony Camp 2007) (20)

PDF
symfony: An Open-Source Framework for Professionals (PHP Day 2008)
PDF
symfony: Simplify your professional web development with PHP (IPC Frankfurt 2...
PDF
symfony: Simplify your professional web development with PHP (Symfony PHP Que...
PDF
Myphp-busters: symfony framework
PDF
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
PDF
Myphp-busters: symfony framework (PHPCon.it)
PDF
Symfony 1.1 - Fabien Potencier
 
PDF
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
PDF
Fabien Potencier "Symfony 4 in action"
PDF
Symfony on steroids
: Vue.js, Mercure, Panther
PDF
Migration of a legacy project to Symfony
PDF
Sympal - Symfony CMS Preview
PDF
How composer saved PHP
PDF
Hands-on with the Symfony2 Framework
PDF
Myphp-busters: symfony framework (php|tek 09)
ODP
Running Symfony
PDF
Symfony4 - Deep dive
PDF
Symfony 2.0 on PHP 5.3
PPT
Symfony: A Brief Introduction
PDF
Artificial Neural Network in a Tic Tac Toe Symfony Console Application - Symf...
symfony: An Open-Source Framework for Professionals (PHP Day 2008)
symfony: Simplify your professional web development with PHP (IPC Frankfurt 2...
symfony: Simplify your professional web development with PHP (Symfony PHP Que...
Myphp-busters: symfony framework
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
Myphp-busters: symfony framework (PHPCon.it)
Symfony 1.1 - Fabien Potencier
 
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
Fabien Potencier "Symfony 4 in action"
Symfony on steroids
: Vue.js, Mercure, Panther
Migration of a legacy project to Symfony
Sympal - Symfony CMS Preview
How composer saved PHP
Hands-on with the Symfony2 Framework
Myphp-busters: symfony framework (php|tek 09)
Running Symfony
Symfony4 - Deep dive
Symfony 2.0 on PHP 5.3
Symfony: A Brief Introduction
Artificial Neural Network in a Tic Tac Toe Symfony Console Application - Symf...
Ad

More from Fabien Potencier (20)

PDF
PDF
Look beyond PHP
PDF
Dependency injection in PHP 5.3/5.4
PDF
Dependency injection-zendcon-2010
PDF
Caching on the Edge
PDF
Design patterns revisited with PHP 5.3
PDF
The state of Symfony2 - SymfonyDay 2010
PDF
PhpBB meets Symfony2
PDF
Dependency injection - phpday 2010
PDF
Symfony2 - WebExpo 2010
PDF
Symfony2 - WebExpo 2010
PDF
Symfony2 - OSIDays 2010
PDF
Dependency Injection IPC 201
PDF
Caching on the Edge with Symfony2
PDF
Unit and Functional Testing with Symfony2
PDF
News of the Symfony2 World
PDF
Dependency Injection - ConFoo 2010
PDF
Dependency Injection
PDF
Symfony Components
PDF
PHP 5.3 in practice
Look beyond PHP
Dependency injection in PHP 5.3/5.4
Dependency injection-zendcon-2010
Caching on the Edge
Design patterns revisited with PHP 5.3
The state of Symfony2 - SymfonyDay 2010
PhpBB meets Symfony2
Dependency injection - phpday 2010
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
Symfony2 - OSIDays 2010
Dependency Injection IPC 201
Caching on the Edge with Symfony2
Unit and Functional Testing with Symfony2
News of the Symfony2 World
Dependency Injection - ConFoo 2010
Dependency Injection
Symfony Components
PHP 5.3 in practice
Ad

Recently uploaded (20)

PDF
Chapter 2 Digital Image Fundamentals.pdf
PPTX
Cloud computing and distributed systems.
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
cuic standard and advanced reporting.pdf
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Advanced IT Governance
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
NewMind AI Weekly Chronicles - August'25 Week I
Chapter 2 Digital Image Fundamentals.pdf
Cloud computing and distributed systems.
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Advanced methodologies resolving dimensionality complications for autism neur...
MYSQL Presentation for SQL database connectivity
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Understanding_Digital_Forensics_Presentation.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
cuic standard and advanced reporting.pdf
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Advanced IT Governance
Review of recent advances in non-invasive hemoglobin estimation
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
NewMind AI Weekly Chronicles - August'25 Week I

Write Plugins for symfony (Symfony Camp 2007)

  • 1. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com symfony Write Plugins Fabien Potencier http://www.symfony-project.com/ http://www.sensiolabs.com/
  • 2. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com What is a Plugin? • Directory structure convention •Classes •Filters •Mixins •Helpers •Configuration •Tasks •Modules •Schemas •Model Extensions •Fixtures •Web Assets
  • 3. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com What for? •To contribute back a symfony extension •Another way to package your code •To share code between projects Portability
  • 4. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Let’s build a plugin
  • 5. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Plugin Creation • Choose a name – Choose a prefix (sf is only for Official Plugins) - Your initials for example – If it depends on Propel or Doctrine, add it to the prefix – Choose a main name – Add the « Plugin » suffix • For our simple plugin: fpPropelSimplePlugin • Create a folder plugins/fpPropelSimplePlugin
  • 6. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Add some Web Assets • Put assets in a web/ folder – web/js – web/css – web/images • symfony plugin-install … – Creates a symlink on *nix – Copies all files on Windows in the web/fpPropelSimplePlugin folder plugins/fpPropelSimplePlugin/web/images/test.png > http://localhost/fpPropelSimplePlugin/images/test.png
  • 7. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Add some Model Classes • config/schema.[xml|yml] <database name="propel" package="plugins.fpPropelSimplePlugin.lib.model" ...> propel: _attributes: package: plugins.fpPropelSimplePlugin.lib.model • You can have foreign keys between plugins and the main application
  • 8. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Example sfSimpleBlogPlugin
  • 9. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Add some Configuration • Make your plugin customizable – apps/APP/config/app.yml – Prefix with the plugin name – sfConfig::get(‘app_fpPropelSimplePlugin_XXX’); • config/config.php – Do whatever configuration you want
  • 10. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Example • sfGuardPlugin config/config.php apps/APP/config/app.yml
  • 11. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Propel Behaviors • sfPropelParanoidBehaviorPlugin config/config.php
  • 12. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Add some Modules • Same structure as a « normal » module – You can move module from your application to the modules/ plugin folder – But you must « enable » it in settings.yml
  • 13. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Example • sfGuardPlugin: Admin Generated modules • sfSimpleCMSPlugin – Actions inheritance – Templates inheritance
  • 14. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Don’t Reinvent the Wheel • Don’t add a security mechanism – Rely on symfony built-in credentials – Use other plugins (sfGuardPlugin) • Don’t add a media library – Use sfMediaLibraryPlugin • Don’t create yet another plugin to do client side validation – Try to enhance existing ones – Contact the main author to discuss your enhancements
  • 15. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Add a LICENSE file • Choose an Open-Source license – MIT – BSD – LGPL – GPL – … • Add a LICENSE file in the root folder
  • 16. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Add a README file • README structure – Installation – Configuration – Customization – Known Limitations – Todo List – Change Log • Trac Wiki Format
  • 17. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Package a Plugin • A symfony Plugin package is a PEAR package • Add a package.xml – Name – Description – Summary – Author(s) – Version – Stability – Dependencies
  • 18. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com
  • 19. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Publish It • For private usage – Host it somewhere symfony plugin-install http://plugins.xxx.com/fpPropelSimplePlugin-1.0.0.tgz • Host it on symfony-project.com – Must be released under an Open-Source license – The community helps you fix bugs and enhance it – Fame
  • 20. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com On symfony-project.com • Create a trac account • Create a new Wiki page named after your plugin name • Attach the PEAR package • Ask Fabien for SVN access • Spread the word… post on the mailing-list & the forum
  • 21. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Next symfony Workshops En français : Paris, France - Dec 05, 2007 In English : Paris, France - Feb 13, 2008 More info on www.sensiolabs.com
  • 22. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com Join Us • Sensio Labs is recruiting in France – project managers – web developers • You have a passion for the web? – Web Developer : You have a minimum of 3 years experience in web development with Open-Source projects and you wish to participate to development of Web 2.0 sites using the best frameworks available. – Project Manager : You have more than 5 years experience as a developer and/or a project manager and you want to manage complex Web projects for prestigious clients.
  • 23. Symfony Camp 2007 www.symfony-project.com [email protected] www.sensiolabs.com SENSIO S.A. 26, rue Salomon de Rothschild 92 286 Suresnes Cedex FRANCE Tél. : +33 1 40 99 80 80 Fax : +33 1 40 99 83 34 Contact Fabien Potencier [email protected] http://www.sensiolabs.com/ http://www.symfony-project.com/