SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Making Your PHP Application Easy to Customize John Mertic @2010 SugarCRM Inc. All rights reserved.
Who Am I? John Mertic http://jmertic.wordpress.com Twitter: @jmertic jmertic@sugarcrm.com ( Work ) jmertic@php.net ( PHP ) Community Manager for SugarCRM http://www.sugarcrm.com Read our blog at http://developers.sugarcrm.com/wordpress 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 2
My books 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 3 http://amzn.to/enioPV http://t.co/UFRHNSO
7/22/2010 @2010 SugarCRM Inc. All rights reserved. Why should my app be easy to customize? 4 Source http://www.flickr.com/photos/duncan/4782911809
So how should you do this?
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 6 Make your code open Source http://www.flickr.com/photos/igalko/4502271194
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 7 Starting off with a good file structure
Things good to do here File naming convention Zend Framework approach Class Zend_Db_Table is at "Zend/Db/Table.php” Abstract class Zend_Controller_Request_Abstract is at “Zend/Controller/Request/Abstract.php” Interface Zend_Validate_Interface is at “Zend/Validate/Interface.php” Allowing file/class overrides SugarCRM approach Can drop in a replacement file in the same location in the custom/ directory Example: Override Contact’s detail view by dropping in a view.detail.php file in the custom/modules/Contacts/views/ directory. 7/27/11 @2010 SugarCRM Inc. All rights reserved. 8
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 9 Source http://www.flickr.com/photos/cype_applejuice/43750657 Code Design
Dependency Injection class Widgets {     protected $_dbConn;     public function __construct()     {         $this->_dbConn = DBFactory::getInstance();     } } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 10
Dependency Injection class Widgets {     protected $_dbConn;     public function __construct( DBInstance $dbConn )     {         $this->_dbConn = $dbConn;     } } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 11
Dependency Injection class Widgets {     protected $_dbConn;     public function __construct() { }     public function setDBConnection(  DBInstance$dbConn )     {         $this->_dbConn = $dbConn;     } } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 12
Interfaces and Abstracts interface LoggerTemplate {     /**      * Main method for handling logging a message to the logger      *      * @param string $level logging level for the message      * @param string $message      */     public function log(         $method,         $message         ); } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 13
Interfaces and Abstracts abstract class loc_xml extends source {  	public function __parse($file)  	{  		$contents = file_get_contents($file);  		return simplexml_load_string($contents);  	}  	public abstract function getItem( 	$args=array(),  	$module=null); 	public abstract function getList( 	$args=array(),  	$module=null); } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 14
Factory Loaders class ControllerFactory { 	/** 	 * Obtain an instance of the correct controller. 	 *  	 * @return an instance of SugarController 	 */ 	function getController($module) 	{ 		$class = ucfirst($module).'Controller'; 		$customClass = 'Custom' . $class; 		if(file_exists('custom/modules/'.$module.'/controller.php')){ 			$customClass = 'Custom' . $class;		 require_once('custom/modules/'.$module.'/controller.php'); 			if(class_exists($customClass)){ 				$controller = new $customClass(); 			}else if(class_exists($class)){ 				$controller = new $class(); } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 15
Factory Loaders 		}elseif(file_exists('modules/'.$module.'/controller.php')){		 require_once('modules/'.$module.'/controller.php'); 			if(class_exists($customClass)){ 				$controller = new $customClass(); 			}else if(class_exists($class)){ 				$controller = new $class(); 			} 		}else{ 			if(file_exists('custom/include/MVC/Controller/SugarController.php')){ require_once('custom/include/MVC/Controller/SugarController.php'); 			} 			if(class_exists('CustomSugarController')){ 				$controller = new CustomSugarController(); 			}else{ 			$controller = new SugarController(); 			} 		} $controller->setup($module); 		return $controller; 	} } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 16
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 17 Document it! Source: http://www.flickr.com/photos/nicecupoftea/3218211407
Ways to do this Docblock comments Example code Short blog posts/articles Forums / Mailing List Wiki Architectural documentation Full blown developer guide 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 18
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 19 Source: http://www.flickr.com/photos/code_martial/4145914957 Learn from your developers
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 20 Questions? To contact me after my presentation, text 2OR to INTRO (46876)

Weitere ähnliche Inhalte

Andere mochten auch

Ergonomie : performance et satisfaction de nos clients
Ergonomie : performance et satisfaction de nos clientsErgonomie : performance et satisfaction de nos clients
Ergonomie : performance et satisfaction de nos clientsLaurence Vagner
 
L'Ergonomie pour les Nuls
L'Ergonomie pour les NulsL'Ergonomie pour les Nuls
L'Ergonomie pour les NulsPALO IT
 
Introduction à l'ergonomie - Drupal Lyon
Introduction à l'ergonomie - Drupal LyonIntroduction à l'ergonomie - Drupal Lyon
Introduction à l'ergonomie - Drupal LyonOlivier Lorrain
 
Poste de travail en parodontie
Poste de travail en parodontiePoste de travail en parodontie
Poste de travail en parodontieMounir ZAGHEZ
 
Charte Ergonomique
Charte Ergonomique Charte Ergonomique
Charte Ergonomique Rached Krim
 
Adapter son poste de travail, pourquoi ?
Adapter son poste de travail, pourquoi ?Adapter son poste de travail, pourquoi ?
Adapter son poste de travail, pourquoi ?DanSchwei
 
Ergonomie avec Microsoft Hardware
Ergonomie avec Microsoft HardwareErgonomie avec Microsoft Hardware
Ergonomie avec Microsoft HardwareNicolas Vernet
 
Gestion de Ressources Humaines
Gestion de Ressources HumainesGestion de Ressources Humaines
Gestion de Ressources Humainessharescholar
 
Td 1 notion d'ergonomie
Td 1 notion d'ergonomieTd 1 notion d'ergonomie
Td 1 notion d'ergonomieMounir ZAGHEZ
 
Ergonomie en entreprise
Ergonomie en entrepriseErgonomie en entreprise
Ergonomie en entrepriseHR SCOPE
 

Andere mochten auch (13)

Ergonomie : performance et satisfaction de nos clients
Ergonomie : performance et satisfaction de nos clientsErgonomie : performance et satisfaction de nos clients
Ergonomie : performance et satisfaction de nos clients
 
L'Ergonomie pour les Nuls
L'Ergonomie pour les NulsL'Ergonomie pour les Nuls
L'Ergonomie pour les Nuls
 
Introduction à l'ergonomie - Drupal Lyon
Introduction à l'ergonomie - Drupal LyonIntroduction à l'ergonomie - Drupal Lyon
Introduction à l'ergonomie - Drupal Lyon
 
Poste de travail en parodontie
Poste de travail en parodontiePoste de travail en parodontie
Poste de travail en parodontie
 
Diapo ressources humaines
Diapo ressources humainesDiapo ressources humaines
Diapo ressources humaines
 
Charte Ergonomique
Charte Ergonomique Charte Ergonomique
Charte Ergonomique
 
Gestion des ressources humaines
Gestion des ressources humainesGestion des ressources humaines
Gestion des ressources humaines
 
Adapter son poste de travail, pourquoi ?
Adapter son poste de travail, pourquoi ?Adapter son poste de travail, pourquoi ?
Adapter son poste de travail, pourquoi ?
 
Ergonomie avec Microsoft Hardware
Ergonomie avec Microsoft HardwareErgonomie avec Microsoft Hardware
Ergonomie avec Microsoft Hardware
 
Gestion de Ressources Humaines
Gestion de Ressources HumainesGestion de Ressources Humaines
Gestion de Ressources Humaines
 
Td 1 notion d'ergonomie
Td 1 notion d'ergonomieTd 1 notion d'ergonomie
Td 1 notion d'ergonomie
 
Ergonomie en entreprise
Ergonomie en entrepriseErgonomie en entreprise
Ergonomie en entreprise
 
Ergonomie
Ergonomie Ergonomie
Ergonomie
 

Ähnlich wie OSCON 2011 - Making Your PHP Application Easy to Customize

20 ways the i pad can be a powerful
20 ways the i pad can be a powerful20 ways the i pad can be a powerful
20 ways the i pad can be a powerfulGMPDC
 
20 ways the_i_pad_can_be_a_powerful97
20 ways the_i_pad_can_be_a_powerful9720 ways the_i_pad_can_be_a_powerful97
20 ways the_i_pad_can_be_a_powerful97GMPDC
 
Using protobuf in your android app
Using protobuf in your android appUsing protobuf in your android app
Using protobuf in your android appMohsen Mirhoseini
 
Cocktails – Shaken, Not Stirred @osdc.tw
Cocktails – Shaken, Not Stirred @osdc.twCocktails – Shaken, Not Stirred @osdc.tw
Cocktails – Shaken, Not Stirred @osdc.twYu-Wei Chuang
 
Developing Easily Deployable PHP Applications ( OSCON 2010 )
Developing Easily Deployable PHP Applications ( OSCON 2010 )Developing Easily Deployable PHP Applications ( OSCON 2010 )
Developing Easily Deployable PHP Applications ( OSCON 2010 )John Mertic
 
ASP.NET で作るとあるTwitter Bot -開発環境からネット公開までぜんぶ無料だよ!-
ASP.NET で作るとあるTwitter Bot -開発環境からネット公開までぜんぶ無料だよ!-ASP.NET で作るとあるTwitter Bot -開発環境からネット公開までぜんぶ無料だよ!-
ASP.NET で作るとあるTwitter Bot -開発環境からネット公開までぜんぶ無料だよ!-Jun-ichi Sakamoto
 
OSCON 2011 - Building An Application On The SugarCRM Platform
OSCON 2011 - Building An Application On The SugarCRM PlatformOSCON 2011 - Building An Application On The SugarCRM Platform
OSCON 2011 - Building An Application On The SugarCRM PlatformJohn Mertic
 
Job Managment Portlet
Job Managment PortletJob Managment Portlet
Job Managment Portletriround
 
SharePoint Migration What do I expect ? (The issues and solutions)
SharePoint Migration What do I expect ? (The issues and solutions)SharePoint Migration What do I expect ? (The issues and solutions)
SharePoint Migration What do I expect ? (The issues and solutions)K.Mohamed Faizal
 
Facebook Development with Zend Framework
Facebook Development with Zend FrameworkFacebook Development with Zend Framework
Facebook Development with Zend FrameworkBrett Harris
 
Movable Type 5 Smartphone Option
Movable Type 5 Smartphone OptionMovable Type 5 Smartphone Option
Movable Type 5 Smartphone OptionSix Apart KK
 
managing your content
managing your contentmanaging your content
managing your contentSamsung
 
Oracle Application Framework Cases
Oracle Application Framework Cases Oracle Application Framework Cases
Oracle Application Framework Cases Feras Ahmad
 
How To Write A Robot For Google Wave
How To Write A Robot For Google WaveHow To Write A Robot For Google Wave
How To Write A Robot For Google WaveMaximumHit Ltd
 
Facebook's Apps II part
Facebook's Apps II partFacebook's Apps II part
Facebook's Apps II partFelix Rivas
 
embedding web browser in your app
embedding web browser in your appembedding web browser in your app
embedding web browser in your appSamsung
 
Google Devfest Singapore - OpenSocial
Google Devfest Singapore - OpenSocialGoogle Devfest Singapore - OpenSocial
Google Devfest Singapore - OpenSocialPatrick Chanezon
 
IMS Learning Tools Interoperability @ UCLA
IMS Learning Tools Interoperability @ UCLAIMS Learning Tools Interoperability @ UCLA
IMS Learning Tools Interoperability @ UCLACharles Severance
 
Movable Type Seminar 2011
Movable Type Seminar 2011Movable Type Seminar 2011
Movable Type Seminar 2011Six Apart KK
 

Ähnlich wie OSCON 2011 - Making Your PHP Application Easy to Customize (20)

20 ways the i pad can be a powerful
20 ways the i pad can be a powerful20 ways the i pad can be a powerful
20 ways the i pad can be a powerful
 
20 ways the_i_pad_can_be_a_powerful97
20 ways the_i_pad_can_be_a_powerful9720 ways the_i_pad_can_be_a_powerful97
20 ways the_i_pad_can_be_a_powerful97
 
Using protobuf in your android app
Using protobuf in your android appUsing protobuf in your android app
Using protobuf in your android app
 
Cocktails – Shaken, Not Stirred @osdc.tw
Cocktails – Shaken, Not Stirred @osdc.twCocktails – Shaken, Not Stirred @osdc.tw
Cocktails – Shaken, Not Stirred @osdc.tw
 
Developing Easily Deployable PHP Applications ( OSCON 2010 )
Developing Easily Deployable PHP Applications ( OSCON 2010 )Developing Easily Deployable PHP Applications ( OSCON 2010 )
Developing Easily Deployable PHP Applications ( OSCON 2010 )
 
ASP.NET で作るとあるTwitter Bot -開発環境からネット公開までぜんぶ無料だよ!-
ASP.NET で作るとあるTwitter Bot -開発環境からネット公開までぜんぶ無料だよ!-ASP.NET で作るとあるTwitter Bot -開発環境からネット公開までぜんぶ無料だよ!-
ASP.NET で作るとあるTwitter Bot -開発環境からネット公開までぜんぶ無料だよ!-
 
OSCON 2011 - Building An Application On The SugarCRM Platform
OSCON 2011 - Building An Application On The SugarCRM PlatformOSCON 2011 - Building An Application On The SugarCRM Platform
OSCON 2011 - Building An Application On The SugarCRM Platform
 
Job Managment Portlet
Job Managment PortletJob Managment Portlet
Job Managment Portlet
 
Django introduction
Django introductionDjango introduction
Django introduction
 
SharePoint Migration What do I expect ? (The issues and solutions)
SharePoint Migration What do I expect ? (The issues and solutions)SharePoint Migration What do I expect ? (The issues and solutions)
SharePoint Migration What do I expect ? (The issues and solutions)
 
Facebook Development with Zend Framework
Facebook Development with Zend FrameworkFacebook Development with Zend Framework
Facebook Development with Zend Framework
 
Movable Type 5 Smartphone Option
Movable Type 5 Smartphone OptionMovable Type 5 Smartphone Option
Movable Type 5 Smartphone Option
 
managing your content
managing your contentmanaging your content
managing your content
 
Oracle Application Framework Cases
Oracle Application Framework Cases Oracle Application Framework Cases
Oracle Application Framework Cases
 
How To Write A Robot For Google Wave
How To Write A Robot For Google WaveHow To Write A Robot For Google Wave
How To Write A Robot For Google Wave
 
Facebook's Apps II part
Facebook's Apps II partFacebook's Apps II part
Facebook's Apps II part
 
embedding web browser in your app
embedding web browser in your appembedding web browser in your app
embedding web browser in your app
 
Google Devfest Singapore - OpenSocial
Google Devfest Singapore - OpenSocialGoogle Devfest Singapore - OpenSocial
Google Devfest Singapore - OpenSocial
 
IMS Learning Tools Interoperability @ UCLA
IMS Learning Tools Interoperability @ UCLAIMS Learning Tools Interoperability @ UCLA
IMS Learning Tools Interoperability @ UCLA
 
Movable Type Seminar 2011
Movable Type Seminar 2011Movable Type Seminar 2011
Movable Type Seminar 2011
 

Mehr von John Mertic

The Virtual Git Summit - Subversion to Git - A Sugar Story
The Virtual Git Summit - Subversion to Git - A Sugar StoryThe Virtual Git Summit - Subversion to Git - A Sugar Story
The Virtual Git Summit - Subversion to Git - A Sugar StoryJohn Mertic
 
PHPBenelux 2012 - Working successfully outside the cube
PHPBenelux 2012 - Working successfully outside the cubePHPBenelux 2012 - Working successfully outside the cube
PHPBenelux 2012 - Working successfully outside the cubeJohn Mertic
 
LinuxCon Brazil 2011 - Hack your team, your Department, and Your Organization...
LinuxCon Brazil 2011 - Hack your team, your Department, and Your Organization...LinuxCon Brazil 2011 - Hack your team, your Department, and Your Organization...
LinuxCon Brazil 2011 - Hack your team, your Department, and Your Organization...John Mertic
 
Astricon 2011 - Connecting SugarCRM with your PBX
Astricon 2011 - Connecting SugarCRM with your PBXAstricon 2011 - Connecting SugarCRM with your PBX
Astricon 2011 - Connecting SugarCRM with your PBXJohn Mertic
 
LinuxTag 2011 - Using SugarCRM when you aren't doing CRM Examples of SugarCRM...
LinuxTag 2011 - Using SugarCRM when you aren't doing CRM Examples of SugarCRM...LinuxTag 2011 - Using SugarCRM when you aren't doing CRM Examples of SugarCRM...
LinuxTag 2011 - Using SugarCRM when you aren't doing CRM Examples of SugarCRM...John Mertic
 
Making Software Management tools work for you - 2011 PHPBenelux Conference
Making Software Management tools work for you - 2011 PHPBenelux ConferenceMaking Software Management tools work for you - 2011 PHPBenelux Conference
Making Software Management tools work for you - 2011 PHPBenelux ConferenceJohn Mertic
 
SugarCON 2009 - Theme Development in Sugar 5.5
SugarCON 2009 - Theme Development in Sugar 5.5SugarCON 2009 - Theme Development in Sugar 5.5
SugarCON 2009 - Theme Development in Sugar 5.5John Mertic
 
SugarCon 2010 - Sugar as a Business Application Framework
SugarCon 2010 - Sugar as a Business Application Framework SugarCon 2010 - Sugar as a Business Application Framework
SugarCon 2010 - Sugar as a Business Application Framework John Mertic
 
SugarCon 2010 - Best Practices for Creating Custom Apps in Sugar
SugarCon 2010 - Best Practices for Creating Custom Apps in SugarSugarCon 2010 - Best Practices for Creating Custom Apps in Sugar
SugarCon 2010 - Best Practices for Creating Custom Apps in SugarJohn Mertic
 
2009 Ontario GNU Linux Fest - Build your business on SugarCRM
2009 Ontario GNU Linux Fest - Build your business on SugarCRM2009 Ontario GNU Linux Fest - Build your business on SugarCRM
2009 Ontario GNU Linux Fest - Build your business on SugarCRMJohn Mertic
 

Mehr von John Mertic (10)

The Virtual Git Summit - Subversion to Git - A Sugar Story
The Virtual Git Summit - Subversion to Git - A Sugar StoryThe Virtual Git Summit - Subversion to Git - A Sugar Story
The Virtual Git Summit - Subversion to Git - A Sugar Story
 
PHPBenelux 2012 - Working successfully outside the cube
PHPBenelux 2012 - Working successfully outside the cubePHPBenelux 2012 - Working successfully outside the cube
PHPBenelux 2012 - Working successfully outside the cube
 
LinuxCon Brazil 2011 - Hack your team, your Department, and Your Organization...
LinuxCon Brazil 2011 - Hack your team, your Department, and Your Organization...LinuxCon Brazil 2011 - Hack your team, your Department, and Your Organization...
LinuxCon Brazil 2011 - Hack your team, your Department, and Your Organization...
 
Astricon 2011 - Connecting SugarCRM with your PBX
Astricon 2011 - Connecting SugarCRM with your PBXAstricon 2011 - Connecting SugarCRM with your PBX
Astricon 2011 - Connecting SugarCRM with your PBX
 
LinuxTag 2011 - Using SugarCRM when you aren't doing CRM Examples of SugarCRM...
LinuxTag 2011 - Using SugarCRM when you aren't doing CRM Examples of SugarCRM...LinuxTag 2011 - Using SugarCRM when you aren't doing CRM Examples of SugarCRM...
LinuxTag 2011 - Using SugarCRM when you aren't doing CRM Examples of SugarCRM...
 
Making Software Management tools work for you - 2011 PHPBenelux Conference
Making Software Management tools work for you - 2011 PHPBenelux ConferenceMaking Software Management tools work for you - 2011 PHPBenelux Conference
Making Software Management tools work for you - 2011 PHPBenelux Conference
 
SugarCON 2009 - Theme Development in Sugar 5.5
SugarCON 2009 - Theme Development in Sugar 5.5SugarCON 2009 - Theme Development in Sugar 5.5
SugarCON 2009 - Theme Development in Sugar 5.5
 
SugarCon 2010 - Sugar as a Business Application Framework
SugarCon 2010 - Sugar as a Business Application Framework SugarCon 2010 - Sugar as a Business Application Framework
SugarCon 2010 - Sugar as a Business Application Framework
 
SugarCon 2010 - Best Practices for Creating Custom Apps in Sugar
SugarCon 2010 - Best Practices for Creating Custom Apps in SugarSugarCon 2010 - Best Practices for Creating Custom Apps in Sugar
SugarCon 2010 - Best Practices for Creating Custom Apps in Sugar
 
2009 Ontario GNU Linux Fest - Build your business on SugarCRM
2009 Ontario GNU Linux Fest - Build your business on SugarCRM2009 Ontario GNU Linux Fest - Build your business on SugarCRM
2009 Ontario GNU Linux Fest - Build your business on SugarCRM
 

Kürzlich hochgeladen

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Kürzlich hochgeladen (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

OSCON 2011 - Making Your PHP Application Easy to Customize

  • 1. Making Your PHP Application Easy to Customize John Mertic @2010 SugarCRM Inc. All rights reserved.
  • 2. Who Am I? John Mertic http://jmertic.wordpress.com Twitter: @jmertic jmertic@sugarcrm.com ( Work ) jmertic@php.net ( PHP ) Community Manager for SugarCRM http://www.sugarcrm.com Read our blog at http://developers.sugarcrm.com/wordpress 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 2
  • 3. My books 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 3 http://amzn.to/enioPV http://t.co/UFRHNSO
  • 4. 7/22/2010 @2010 SugarCRM Inc. All rights reserved. Why should my app be easy to customize? 4 Source http://www.flickr.com/photos/duncan/4782911809
  • 5. So how should you do this?
  • 6. 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 6 Make your code open Source http://www.flickr.com/photos/igalko/4502271194
  • 7. 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 7 Starting off with a good file structure
  • 8. Things good to do here File naming convention Zend Framework approach Class Zend_Db_Table is at "Zend/Db/Table.php” Abstract class Zend_Controller_Request_Abstract is at “Zend/Controller/Request/Abstract.php” Interface Zend_Validate_Interface is at “Zend/Validate/Interface.php” Allowing file/class overrides SugarCRM approach Can drop in a replacement file in the same location in the custom/ directory Example: Override Contact’s detail view by dropping in a view.detail.php file in the custom/modules/Contacts/views/ directory. 7/27/11 @2010 SugarCRM Inc. All rights reserved. 8
  • 9. 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 9 Source http://www.flickr.com/photos/cype_applejuice/43750657 Code Design
  • 10. Dependency Injection class Widgets { protected $_dbConn; public function __construct() { $this->_dbConn = DBFactory::getInstance(); } } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 10
  • 11. Dependency Injection class Widgets { protected $_dbConn; public function __construct( DBInstance $dbConn ) { $this->_dbConn = $dbConn; } } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 11
  • 12. Dependency Injection class Widgets { protected $_dbConn; public function __construct() { } public function setDBConnection( DBInstance$dbConn ) { $this->_dbConn = $dbConn; } } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 12
  • 13. Interfaces and Abstracts interface LoggerTemplate { /** * Main method for handling logging a message to the logger * * @param string $level logging level for the message * @param string $message */ public function log( $method, $message ); } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 13
  • 14. Interfaces and Abstracts abstract class loc_xml extends source { public function __parse($file) { $contents = file_get_contents($file); return simplexml_load_string($contents); } public abstract function getItem( $args=array(), $module=null); public abstract function getList( $args=array(), $module=null); } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 14
  • 15. Factory Loaders class ControllerFactory { /** * Obtain an instance of the correct controller. * * @return an instance of SugarController */ function getController($module) { $class = ucfirst($module).'Controller'; $customClass = 'Custom' . $class; if(file_exists('custom/modules/'.$module.'/controller.php')){ $customClass = 'Custom' . $class; require_once('custom/modules/'.$module.'/controller.php'); if(class_exists($customClass)){ $controller = new $customClass(); }else if(class_exists($class)){ $controller = new $class(); } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 15
  • 16. Factory Loaders }elseif(file_exists('modules/'.$module.'/controller.php')){ require_once('modules/'.$module.'/controller.php'); if(class_exists($customClass)){ $controller = new $customClass(); }else if(class_exists($class)){ $controller = new $class(); } }else{ if(file_exists('custom/include/MVC/Controller/SugarController.php')){ require_once('custom/include/MVC/Controller/SugarController.php'); } if(class_exists('CustomSugarController')){ $controller = new CustomSugarController(); }else{ $controller = new SugarController(); } } $controller->setup($module); return $controller; } } 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 16
  • 17. 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 17 Document it! Source: http://www.flickr.com/photos/nicecupoftea/3218211407
  • 18. Ways to do this Docblock comments Example code Short blog posts/articles Forums / Mailing List Wiki Architectural documentation Full blown developer guide 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 18
  • 19. 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 19 Source: http://www.flickr.com/photos/code_martial/4145914957 Learn from your developers
  • 20. 7/22/2010 @2010 SugarCRM Inc. All rights reserved. 20 Questions? To contact me after my presentation, text 2OR to INTRO (46876)

Hinweis der Redaktion

  1. So CRM is not about technology butall about Customers, YOUR Customers.
  2. User base is diverse, likes different offerings, and will move between them.Lots of choices ( Web Servers / OSes / Databases / PHP versions ) as well as config possibilitiesHave to cover lots of platforms; can rely on particular hardware or software being available.
  3. User base is diverse, likes different offerings, and will move between them.Lots of choices ( Web Servers / OSes / Databases / PHP versions ) as well as config possibilitiesHave to cover lots of platforms; can rely on particular hardware or software being available.
  4. User base is diverse, likes different offerings, and will move between them.Lots of choices ( Web Servers / OSes / Databases / PHP versions ) as well as config possibilitiesHave to cover lots of platforms; can rely on particular hardware or software being available.