SlideShare a Scribd company logo
1 of 32
Francesco Abeni
Sviluppo di estensioni per
Joomla: BEST PRACTICES
@f_abeni
http://www.gibilogic.com
Francesco Abeni
Sviluppo di estensioni per
Joomla: BEST PRACTICES
@f_abeni
http://www.gibilogic.com
Sviluppatore Joomla / PHP
GiBiLogic
https://extensions.gibilogic.com
Watchful
https://watchful.li
DAI LA CERA
TOGLI LA CERA
...ma non sempre
la stessa cera
Usa la LINEA DI
COMANDO, Luke!
Usa GIT
e GitHub
Usa un IDE
decente
(Netbeans, PHPStorm)
CARTELLE
convenzionali
build
docs
release
src
com_jfestival
admin
site
mod_jfestival_talks
plg_search_jfestival
tests
LIBRERIE STANDARD
(jQuery, Bootstrap)
Sai cosa è una CDN?
Uniformati!
PSR FTW!
JTABLE
l'essenziale è invisibile
agli occhi
public function check() {
$user = JFactory::getUser();
if ($this→isAdminUser($user)) {
return true;
}
if ($this→isOwner($user)) {
return true;
}
return false;
}
public function store($updateNulls=false) {
$this→params = json_encode($this→params);
return parent::store($updateNulls);
}
public function load($keys=null, $reset=true) {
$row = parent::load($keys, $reset);
$row→params = json_decode($row→params);
return $row;
}
JMODEL
il tuo magazziniere di
fiducia!
public function get($id) {
$row = JTable::getInstance(
“Talks”, “JfestivalTable”
);
$row→load($id);
return $row;
}
public function getByFields($speaker, $time) {
$row = JTable::getInstance(
“Talks”, “JfestivalTable”
);
$row→load(array(
“name” => “Francesco Abeni”,
“date” => “2015-07-04”
));
return $row;
}
private function getBaseQuery() { // STEP 1
$db = JFactory::getDatabase();
$query = $db->getQuery(true)
→select(“*”)
→from(“#__jfestival_talks”);
return $query;
}
private function buildQuery() { // STEP 2
$query = $this→getBaseQuery();
$filterName = $this→getState(“name”, “”);
if ($filterName) {
$query→where(
“name LIKE '%$filterName%'
);
} //...
return $query;
}
public function getList() {
$db = JFactory::getDbo();
$db→setQuery($this→buildQuery());
try { return $db→loadObjectList(); }
catch (Exception $e) {
JLog::addLog(
$e→getMessage(), JLog::ERROR
);
return array();
}
}
JCONTROLLER / JVIEW
a dieta!
JLOG
non potrai più
farne a meno
public function __construct(...) {
JLog::addLogger(
array(
“text_file” => “jfestival.talks.log.php”
),
JLog::ALL,
'jfestival.talks'
);
}
public function whatever(...) {
JLog::add(
'A debug message',
JLog::DEBUG, 'jfestival.talks'
);
JLog::add(
'An info message',
JLog::INFO, 'jfestival.talks'
);
}
Proprietà privata
protetta e pubblica
public function get($id) { … }
protected function buildQuery() { … }
private function getName() { … }
public $id; // “$object→id” funziona
vs.
private $id; // “$object→id” NON funziona
public function getId() { return $this→id; }
OGGETTI
del discorso
Talks
JfestivalTableTalks
JfestivalModelTalks
JfestivalControllerTalks
JfestivalViewTalks
tmpl/default.php
tmpl/list.php
tmpl/edit.php
Talks
Speakers
Rooms
Sponsors
Attendees
Helpers!
GRAZIE
per voler essere
programmatori
migliori!
Qualche risorsa in ordine sparso
● BOOTSTRAP: http://getbootstrap.com/
● JQUERY: https://jquery.com/
● CDN: https://www.maxcdn.com/
● NETBEANS: http://netbeans.org/
● GITHUB: https://github.com/
● PSR: http://www.php-fig.org/
● BLOG: https://extensions.gibilogic.com/blog.html

More Related Content

What's hot

Full stack-web-design
Full stack-web-designFull stack-web-design
Full stack-web-designKevin Conboy
 
Build and Deploy a Python Web App to Amazon in 30 Mins
Build and Deploy a Python Web App to Amazon in 30 MinsBuild and Deploy a Python Web App to Amazon in 30 Mins
Build and Deploy a Python Web App to Amazon in 30 MinsJeff Hull
 
Prototyping user interactions in web apps
Prototyping user interactions in web appsPrototyping user interactions in web apps
Prototyping user interactions in web appsPatrick NDJIENTCHEU
 
Going Native With React
Going Native With ReactGoing Native With React
Going Native With ReactEric Nograles
 
Making CLIs with Node.js
Making CLIs with Node.jsMaking CLIs with Node.js
Making CLIs with Node.jsJoseph Lust
 
Faire grandir une equipe technique
Faire grandir une equipe techniqueFaire grandir une equipe technique
Faire grandir une equipe techniqueCharles Desneuf
 
Picademy #3 Python Picamera GPIO Workshop
Picademy #3 Python Picamera GPIO WorkshopPicademy #3 Python Picamera GPIO Workshop
Picademy #3 Python Picamera GPIO Workshopbennuttall
 
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Baruch Sadogursky
 
Patterns and antipatterns in Docker image lifecycle as was presented at Devop...
Patterns and antipatterns in Docker image lifecycle as was presented at Devop...Patterns and antipatterns in Docker image lifecycle as was presented at Devop...
Patterns and antipatterns in Docker image lifecycle as was presented at Devop...Baruch Sadogursky
 
Distributed: Reinventing the Workplace
Distributed: Reinventing the WorkplaceDistributed: Reinventing the Workplace
Distributed: Reinventing the WorkplaceYoav Farhi
 
Stop Sucking at Building Stuff!
Stop Sucking at Building Stuff!Stop Sucking at Building Stuff!
Stop Sucking at Building Stuff!Puppet
 

What's hot (15)

DevstackPY
DevstackPYDevstackPY
DevstackPY
 
Extjs Howto
Extjs HowtoExtjs Howto
Extjs Howto
 
Full stack-web-design
Full stack-web-designFull stack-web-design
Full stack-web-design
 
Build and Deploy a Python Web App to Amazon in 30 Mins
Build and Deploy a Python Web App to Amazon in 30 MinsBuild and Deploy a Python Web App to Amazon in 30 Mins
Build and Deploy a Python Web App to Amazon in 30 Mins
 
Prototyping user interactions in web apps
Prototyping user interactions in web appsPrototyping user interactions in web apps
Prototyping user interactions in web apps
 
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
 
Going Native With React
Going Native With ReactGoing Native With React
Going Native With React
 
Making CLIs with Node.js
Making CLIs with Node.jsMaking CLIs with Node.js
Making CLIs with Node.js
 
Faire grandir une equipe technique
Faire grandir une equipe techniqueFaire grandir une equipe technique
Faire grandir une equipe technique
 
LVPHP.org
LVPHP.orgLVPHP.org
LVPHP.org
 
Picademy #3 Python Picamera GPIO Workshop
Picademy #3 Python Picamera GPIO WorkshopPicademy #3 Python Picamera GPIO Workshop
Picademy #3 Python Picamera GPIO Workshop
 
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
 
Patterns and antipatterns in Docker image lifecycle as was presented at Devop...
Patterns and antipatterns in Docker image lifecycle as was presented at Devop...Patterns and antipatterns in Docker image lifecycle as was presented at Devop...
Patterns and antipatterns in Docker image lifecycle as was presented at Devop...
 
Distributed: Reinventing the Workplace
Distributed: Reinventing the WorkplaceDistributed: Reinventing the Workplace
Distributed: Reinventing the Workplace
 
Stop Sucking at Building Stuff!
Stop Sucking at Building Stuff!Stop Sucking at Building Stuff!
Stop Sucking at Building Stuff!
 

Viewers also liked

Breakingbenjamin 110526215424-phpapp02
Breakingbenjamin 110526215424-phpapp02Breakingbenjamin 110526215424-phpapp02
Breakingbenjamin 110526215424-phpapp02Alzeo Robert
 
The Nex Cocreator: Tribal leaderschap - Van frustreren naar faciliteren
The Nex Cocreator: Tribal leaderschap - Van frustreren naar faciliterenThe Nex Cocreator: Tribal leaderschap - Van frustreren naar faciliteren
The Nex Cocreator: Tribal leaderschap - Van frustreren naar faciliterenGamechanger Innovatie
 
Crimen Organizado y Seguridad Ciudadana, Gino Costa - CADE Ejecutivos 2014
Crimen Organizado y Seguridad Ciudadana, Gino Costa - CADE Ejecutivos 2014Crimen Organizado y Seguridad Ciudadana, Gino Costa - CADE Ejecutivos 2014
Crimen Organizado y Seguridad Ciudadana, Gino Costa - CADE Ejecutivos 2014IPAE
 
Dingman APA power point presentation
Dingman APA power point presentationDingman APA power point presentation
Dingman APA power point presentationBHUOnlineDepartment
 
Interferencia Urbana
Interferencia UrbanaInterferencia Urbana
Interferencia UrbanaMarco Sosa
 
Empowering employees to act like entrepreneurs
Empowering employees to act like entrepreneursEmpowering employees to act like entrepreneurs
Empowering employees to act like entrepreneursGamechanger Innovatie
 
Diversificación Productiva, Piero Ghezzi Ministro de la Producción - CADE Eje...
Diversificación Productiva, Piero Ghezzi Ministro de la Producción - CADE Eje...Diversificación Productiva, Piero Ghezzi Ministro de la Producción - CADE Eje...
Diversificación Productiva, Piero Ghezzi Ministro de la Producción - CADE Eje...IPAE
 
Crimen Organizado y Seguridad Ciudadana, Fernando Rospigliosi - CADE Ejecutiv...
Crimen Organizado y Seguridad Ciudadana, Fernando Rospigliosi - CADE Ejecutiv...Crimen Organizado y Seguridad Ciudadana, Fernando Rospigliosi - CADE Ejecutiv...
Crimen Organizado y Seguridad Ciudadana, Fernando Rospigliosi - CADE Ejecutiv...IPAE
 
Manejo de materiales peligrosos
Manejo de materiales peligrososManejo de materiales peligrosos
Manejo de materiales peligrososAlessandra Pereira
 
Spiritual ear development prophetic lesson 3
Spiritual ear development prophetic lesson 3Spiritual ear development prophetic lesson 3
Spiritual ear development prophetic lesson 3Apostle Dr. Norma Gray
 
Visión del Perú al Tercio de Siglo, Juan Infante - CADE Ejecutivos 2014
Visión del Perú al Tercio de Siglo, Juan Infante - CADE Ejecutivos 2014Visión del Perú al Tercio de Siglo, Juan Infante - CADE Ejecutivos 2014
Visión del Perú al Tercio de Siglo, Juan Infante - CADE Ejecutivos 2014IPAE
 
Commas
CommasCommas
CommasSERWRC
 

Viewers also liked (20)

Breakingbenjamin 110526215424-phpapp02
Breakingbenjamin 110526215424-phpapp02Breakingbenjamin 110526215424-phpapp02
Breakingbenjamin 110526215424-phpapp02
 
3360_alt
3360_alt3360_alt
3360_alt
 
acs
acsacs
acs
 
Un dia como docente 2 nuevo
Un dia como docente 2 nuevoUn dia como docente 2 nuevo
Un dia como docente 2 nuevo
 
The Nex Cocreator: Tribal leaderschap - Van frustreren naar faciliteren
The Nex Cocreator: Tribal leaderschap - Van frustreren naar faciliterenThe Nex Cocreator: Tribal leaderschap - Van frustreren naar faciliteren
The Nex Cocreator: Tribal leaderschap - Van frustreren naar faciliteren
 
almi
almialmi
almi
 
BIOGRAPHY
BIOGRAPHYBIOGRAPHY
BIOGRAPHY
 
Crimen Organizado y Seguridad Ciudadana, Gino Costa - CADE Ejecutivos 2014
Crimen Organizado y Seguridad Ciudadana, Gino Costa - CADE Ejecutivos 2014Crimen Organizado y Seguridad Ciudadana, Gino Costa - CADE Ejecutivos 2014
Crimen Organizado y Seguridad Ciudadana, Gino Costa - CADE Ejecutivos 2014
 
Slideshare
SlideshareSlideshare
Slideshare
 
Daninson trejo
Daninson trejoDaninson trejo
Daninson trejo
 
Dingman APA power point presentation
Dingman APA power point presentationDingman APA power point presentation
Dingman APA power point presentation
 
Interferencia Urbana
Interferencia UrbanaInterferencia Urbana
Interferencia Urbana
 
Empowering employees to act like entrepreneurs
Empowering employees to act like entrepreneursEmpowering employees to act like entrepreneurs
Empowering employees to act like entrepreneurs
 
Diversificación Productiva, Piero Ghezzi Ministro de la Producción - CADE Eje...
Diversificación Productiva, Piero Ghezzi Ministro de la Producción - CADE Eje...Diversificación Productiva, Piero Ghezzi Ministro de la Producción - CADE Eje...
Diversificación Productiva, Piero Ghezzi Ministro de la Producción - CADE Eje...
 
Crimen Organizado y Seguridad Ciudadana, Fernando Rospigliosi - CADE Ejecutiv...
Crimen Organizado y Seguridad Ciudadana, Fernando Rospigliosi - CADE Ejecutiv...Crimen Organizado y Seguridad Ciudadana, Fernando Rospigliosi - CADE Ejecutiv...
Crimen Organizado y Seguridad Ciudadana, Fernando Rospigliosi - CADE Ejecutiv...
 
Manejo de materiales peligrosos
Manejo de materiales peligrososManejo de materiales peligrosos
Manejo de materiales peligrosos
 
The Power of Focus
The Power of FocusThe Power of Focus
The Power of Focus
 
Spiritual ear development prophetic lesson 3
Spiritual ear development prophetic lesson 3Spiritual ear development prophetic lesson 3
Spiritual ear development prophetic lesson 3
 
Visión del Perú al Tercio de Siglo, Juan Infante - CADE Ejecutivos 2014
Visión del Perú al Tercio de Siglo, Juan Infante - CADE Ejecutivos 2014Visión del Perú al Tercio de Siglo, Juan Infante - CADE Ejecutivos 2014
Visión del Perú al Tercio de Siglo, Juan Infante - CADE Ejecutivos 2014
 
Commas
CommasCommas
Commas
 

Similar to Francesco abeni joomla_extensions_best_practices

Best practices for joomla extensions developers
Best practices for joomla extensions developersBest practices for joomla extensions developers
Best practices for joomla extensions developersFrancesco Abeni
 
Behavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestBehavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestJoshua Warren
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Ivo Jansch
 
Introduction to Cordova
Introduction to CordovaIntroduction to Cordova
Introduction to CordovaRaymond Camden
 
Odo improving the developer experience on OpenShift - hack & sangria
Odo   improving the developer experience on OpenShift - hack & sangriaOdo   improving the developer experience on OpenShift - hack & sangria
Odo improving the developer experience on OpenShift - hack & sangriaJorge Morales
 
Pharo foreign function interface (FFI) by example by Esteban Lorenzano
Pharo foreign function interface (FFI) by example by Esteban LorenzanoPharo foreign function interface (FFI) by example by Esteban Lorenzano
Pharo foreign function interface (FFI) by example by Esteban LorenzanoFAST
 
Development workflow
Development workflowDevelopment workflow
Development workflowSigsiu.NET
 
Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Asher Martin
 
How Symfony Changed My Life
How Symfony Changed My LifeHow Symfony Changed My Life
How Symfony Changed My LifeMatthias Noback
 
How Symfony changed my life (#SfPot, Paris, 19th November 2015)
How Symfony changed my life (#SfPot, Paris, 19th November 2015)How Symfony changed my life (#SfPot, Paris, 19th November 2015)
How Symfony changed my life (#SfPot, Paris, 19th November 2015)Matthias Noback
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a bossFrancisco Ribeiro
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Pantheon
 
Continous Delivering a PHP application
Continous Delivering a PHP applicationContinous Delivering a PHP application
Continous Delivering a PHP applicationJavier López
 
Eclipse Che: The Next-Gen Eclipse IDE - Bordeaux jug 2016
Eclipse Che: The Next-Gen Eclipse IDE - Bordeaux jug 2016Eclipse Che: The Next-Gen Eclipse IDE - Bordeaux jug 2016
Eclipse Che: The Next-Gen Eclipse IDE - Bordeaux jug 2016Florent BENOIT
 
JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)jeresig
 
API Doc Smackdown
API Doc SmackdownAPI Doc Smackdown
API Doc SmackdownTed Husted
 
All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$Joe Ferguson
 

Similar to Francesco abeni joomla_extensions_best_practices (20)

Best practices for joomla extensions developers
Best practices for joomla extensions developersBest practices for joomla extensions developers
Best practices for joomla extensions developers
 
Behavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestBehavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWest
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
 
Introduction to Cordova
Introduction to CordovaIntroduction to Cordova
Introduction to Cordova
 
Odo improving the developer experience on OpenShift - hack & sangria
Odo   improving the developer experience on OpenShift - hack & sangriaOdo   improving the developer experience on OpenShift - hack & sangria
Odo improving the developer experience on OpenShift - hack & sangria
 
Pharo foreign function interface (FFI) by example by Esteban Lorenzano
Pharo foreign function interface (FFI) by example by Esteban LorenzanoPharo foreign function interface (FFI) by example by Esteban Lorenzano
Pharo foreign function interface (FFI) by example by Esteban Lorenzano
 
Development workflow
Development workflowDevelopment workflow
Development workflow
 
Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3
 
How Symfony Changed My Life
How Symfony Changed My LifeHow Symfony Changed My Life
How Symfony Changed My Life
 
How Symfony changed my life (#SfPot, Paris, 19th November 2015)
How Symfony changed my life (#SfPot, Paris, 19th November 2015)How Symfony changed my life (#SfPot, Paris, 19th November 2015)
How Symfony changed my life (#SfPot, Paris, 19th November 2015)
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a boss
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
Introduction to python scrapping
Introduction to python scrappingIntroduction to python scrapping
Introduction to python scrapping
 
CICD_1670665418.pdf
CICD_1670665418.pdfCICD_1670665418.pdf
CICD_1670665418.pdf
 
Continous Delivering a PHP application
Continous Delivering a PHP applicationContinous Delivering a PHP application
Continous Delivering a PHP application
 
Eclipse Che: The Next-Gen Eclipse IDE - Bordeaux jug 2016
Eclipse Che: The Next-Gen Eclipse IDE - Bordeaux jug 2016Eclipse Che: The Next-Gen Eclipse IDE - Bordeaux jug 2016
Eclipse Che: The Next-Gen Eclipse IDE - Bordeaux jug 2016
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)
 
API Doc Smackdown
API Doc SmackdownAPI Doc Smackdown
API Doc Smackdown
 
All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$
 

Francesco abeni joomla_extensions_best_practices