SlideShare a Scribd company logo
1 of 23
Download to read offline
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

Similar to Write Plugins for symfony (Symfony Camp 2007)

symfony: An Open-Source Framework for Professionals (PHP Day 2008)
symfony: An Open-Source Framework for Professionals (PHP Day 2008)symfony: An Open-Source Framework for Professionals (PHP Day 2008)
symfony: An Open-Source Framework for Professionals (PHP Day 2008)Fabien Potencier
 
symfony: Simplify your professional web development with PHP (IPC Frankfurt 2...
symfony: Simplify your professional web development with PHP (IPC Frankfurt 2...symfony: Simplify your professional web development with PHP (IPC Frankfurt 2...
symfony: Simplify your professional web development with PHP (IPC Frankfurt 2...Fabien Potencier
 
symfony: Simplify your professional web development with PHP (Symfony PHP Que...
symfony: Simplify your professional web development with PHP (Symfony PHP Que...symfony: Simplify your professional web development with PHP (Symfony PHP Que...
symfony: Simplify your professional web development with PHP (Symfony PHP Que...Fabien Potencier
 
Myphp-busters: symfony framework
Myphp-busters: symfony frameworkMyphp-busters: symfony framework
Myphp-busters: symfony frameworkStefan Koopmanschap
 
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)Fabien Potencier
 
Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)Stefan Koopmanschap
 
Symfony 1.1 - Fabien Potencier
Symfony 1.1 - Fabien PotencierSymfony 1.1 - Fabien Potencier
Symfony 1.1 - Fabien Potencierdpc
 
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...Les-Tilleuls.coop
 
Fabien Potencier "Symfony 4 in action"
Fabien Potencier "Symfony 4 in action"Fabien Potencier "Symfony 4 in action"
Fabien Potencier "Symfony 4 in action"Fwdays
 
Symfony on steroids
: Vue.js, Mercure, Panther
Symfony on steroids
: Vue.js, Mercure, PantherSymfony on steroids
: Vue.js, Mercure, Panther
Symfony on steroids
: Vue.js, Mercure, PantherLes-Tilleuls.coop
 
Migration of a legacy project to Symfony
Migration of a legacy project to SymfonyMigration of a legacy project to Symfony
Migration of a legacy project to SymfonyPixel Federation
 
Sympal - Symfony CMS Preview
Sympal - Symfony CMS PreviewSympal - Symfony CMS Preview
Sympal - Symfony CMS PreviewJonathan Wage
 
How composer saved PHP
How composer saved PHPHow composer saved PHP
How composer saved PHPRyan Kilfedder
 
Hands-on with the Symfony2 Framework
Hands-on with the Symfony2 FrameworkHands-on with the Symfony2 Framework
Hands-on with the Symfony2 FrameworkRyan Weaver
 
Myphp-busters: symfony framework (php|tek 09)
Myphp-busters: symfony framework (php|tek 09)Myphp-busters: symfony framework (php|tek 09)
Myphp-busters: symfony framework (php|tek 09)Stefan Koopmanschap
 
Symfony4 - Deep dive
Symfony4 - Deep diveSymfony4 - Deep dive
Symfony4 - Deep diveSalma Ghareeb
 
Symfony: A Brief Introduction
Symfony: A Brief IntroductionSymfony: A Brief Introduction
Symfony: A Brief IntroductionCraig Willis
 
Artificial Neural Networks with PHP & Symfony con 2014
Artificial Neural Networks with PHP & Symfony con 2014Artificial Neural Networks with PHP & Symfony con 2014
Artificial Neural Networks with PHP & Symfony con 2014Eduardo Gulias Davis
 

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

symfony: An Open-Source Framework for Professionals (PHP Day 2008)
symfony: An Open-Source Framework for Professionals (PHP Day 2008)symfony: An Open-Source Framework for Professionals (PHP Day 2008)
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 (IPC Frankfurt 2...symfony: Simplify your professional web development with PHP (IPC Frankfurt 2...
symfony: Simplify your professional web development with PHP (IPC Frankfurt 2...
 
symfony: Simplify your professional web development with PHP (Symfony PHP Que...
symfony: Simplify your professional web development with PHP (Symfony PHP Que...symfony: Simplify your professional web development with PHP (Symfony PHP Que...
symfony: Simplify your professional web development with PHP (Symfony PHP Que...
 
Myphp-busters: symfony framework
Myphp-busters: symfony frameworkMyphp-busters: symfony framework
Myphp-busters: symfony framework
 
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
 
Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)
 
Symfony 1.1 - Fabien Potencier
Symfony 1.1 - Fabien PotencierSymfony 1.1 - Fabien Potencier
Symfony 1.1 - Fabien Potencier
 
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
 
Fabien Potencier "Symfony 4 in action"
Fabien Potencier "Symfony 4 in action"Fabien Potencier "Symfony 4 in action"
Fabien Potencier "Symfony 4 in action"
 
Symfony on steroids
: Vue.js, Mercure, Panther
Symfony on steroids
: Vue.js, Mercure, PantherSymfony on steroids
: Vue.js, Mercure, Panther
Symfony on steroids
: Vue.js, Mercure, Panther
 
Migration of a legacy project to Symfony
Migration of a legacy project to SymfonyMigration of a legacy project to Symfony
Migration of a legacy project to Symfony
 
Sympal - Symfony CMS Preview
Sympal - Symfony CMS PreviewSympal - Symfony CMS Preview
Sympal - Symfony CMS Preview
 
How composer saved PHP
How composer saved PHPHow composer saved PHP
How composer saved PHP
 
Hands-on with the Symfony2 Framework
Hands-on with the Symfony2 FrameworkHands-on with the Symfony2 Framework
Hands-on with the Symfony2 Framework
 
Myphp-busters: symfony framework (php|tek 09)
Myphp-busters: symfony framework (php|tek 09)Myphp-busters: symfony framework (php|tek 09)
Myphp-busters: symfony framework (php|tek 09)
 
Running Symfony
Running SymfonyRunning Symfony
Running Symfony
 
Symfony4 - Deep dive
Symfony4 - Deep diveSymfony4 - Deep dive
Symfony4 - Deep dive
 
Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3
 
Symfony: A Brief Introduction
Symfony: A Brief IntroductionSymfony: A Brief Introduction
Symfony: A Brief Introduction
 
Artificial Neural Networks with PHP & Symfony con 2014
Artificial Neural Networks with PHP & Symfony con 2014Artificial Neural Networks with PHP & Symfony con 2014
Artificial Neural Networks with PHP & Symfony con 2014
 

More from Fabien Potencier

Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Fabien Potencier
 
Dependency injection-zendcon-2010
Dependency injection-zendcon-2010Dependency injection-zendcon-2010
Dependency injection-zendcon-2010Fabien Potencier
 
Design patterns revisited with PHP 5.3
Design patterns revisited with PHP 5.3Design patterns revisited with PHP 5.3
Design patterns revisited with PHP 5.3Fabien Potencier
 
The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010Fabien Potencier
 
Dependency injection - phpday 2010
Dependency injection - phpday 2010Dependency injection - phpday 2010
Dependency injection - phpday 2010Fabien Potencier
 
Dependency Injection IPC 201
Dependency Injection IPC 201Dependency Injection IPC 201
Dependency Injection IPC 201Fabien Potencier
 
Caching on the Edge with Symfony2
Caching on the Edge with Symfony2Caching on the Edge with Symfony2
Caching on the Edge with Symfony2Fabien Potencier
 
Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2Fabien Potencier
 
News of the Symfony2 World
News of the Symfony2 WorldNews of the Symfony2 World
News of the Symfony2 WorldFabien Potencier
 
Dependency Injection - ConFoo 2010
Dependency Injection - ConFoo 2010Dependency Injection - ConFoo 2010
Dependency Injection - ConFoo 2010Fabien Potencier
 

More from Fabien Potencier (20)

Varnish
VarnishVarnish
Varnish
 
Look beyond PHP
Look beyond PHPLook beyond PHP
Look beyond PHP
 
Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4
 
Dependency injection-zendcon-2010
Dependency injection-zendcon-2010Dependency injection-zendcon-2010
Dependency injection-zendcon-2010
 
Caching on the Edge
Caching on the EdgeCaching on the Edge
Caching on the Edge
 
Design patterns revisited with PHP 5.3
Design patterns revisited with PHP 5.3Design patterns revisited with PHP 5.3
Design patterns revisited with PHP 5.3
 
The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010
 
PhpBB meets Symfony2
PhpBB meets Symfony2PhpBB meets Symfony2
PhpBB meets Symfony2
 
Dependency injection - phpday 2010
Dependency injection - phpday 2010Dependency injection - phpday 2010
Dependency injection - phpday 2010
 
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
 
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
 
Symfony2 - OSIDays 2010
Symfony2 - OSIDays 2010Symfony2 - OSIDays 2010
Symfony2 - OSIDays 2010
 
Dependency Injection IPC 201
Dependency Injection IPC 201Dependency Injection IPC 201
Dependency Injection IPC 201
 
Caching on the Edge with Symfony2
Caching on the Edge with Symfony2Caching on the Edge with Symfony2
Caching on the Edge with Symfony2
 
Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2
 
News of the Symfony2 World
News of the Symfony2 WorldNews of the Symfony2 World
News of the Symfony2 World
 
Dependency Injection - ConFoo 2010
Dependency Injection - ConFoo 2010Dependency Injection - ConFoo 2010
Dependency Injection - ConFoo 2010
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Symfony Components
Symfony ComponentsSymfony Components
Symfony Components
 
PHP 5.3 in practice
PHP 5.3 in practicePHP 5.3 in practice
PHP 5.3 in practice
 

Recently uploaded

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Recently uploaded (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

Write Plugins for symfony (Symfony Camp 2007)

  • 1. 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/
  • 2. 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
  • 3. 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
  • 4. Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com Let’s build a plugin
  • 5. 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
  • 6. 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
  • 7. 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
  • 8. Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com Example sfSimpleBlogPlugin
  • 9. 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
  • 10. Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com Example • sfGuardPlugin config/config.php apps/APP/config/app.yml
  • 11. Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com Propel Behaviors • sfPropelParanoidBehaviorPlugin config/config.php
  • 12. 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
  • 13. Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com Example • sfGuardPlugin: Admin Generated modules • sfSimpleCMSPlugin – Actions inheritance – Templates inheritance
  • 14. 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
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. Symfony Camp 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensiolabs.com
  • 19. 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
  • 20. 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
  • 21. 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
  • 22. 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.
  • 23. 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/