Salzburg WebDev Meetup PHP Symfony

There are plenty of other
frameworks in the sea PHP + Symfony

FINDOLOGIC GMBH
GEORG M. SORST
G.SORST@FINDOLOGIC.COM
WebDev Meetup 20.11.2013
FINDOLOGIC

◼
◼

◼
◼

Search for online stores
>100M queries / month
A dozen servers
One of Salzburg’s most successful startups
Business
LAN
BBQ
Trachty Friday
We’re hiring

DEVELOPERS DEVELOPERS DEVELOPERS!
History

◼
◼

◼
◼

Born in the web 20 years ago
Form interpreter to replace perl
Core is backed by a company (Zend)
1M to 100M hostnames in 10 years
Stack Overflow tags

Source: http://hewgill.com/~greg/stackoverflow/stack_overflow/tags/
W3Techs

Source: http://w3techs.com/technologies/overview/programming_language/all
Usage

◼ eCommerce: osCommerce, Zen Cart,
Magento, PrestaShop, OpenCart, Oxid,
xtCommerce, Shopware
◼ CMS: Wordpress, Joomla, Drupal
◼ Other: Wikipedia, Digg, Facebook
The good

◼

◼
◼

Dead simple: <?php echo “Hello
world”;
Runs everywhere
Documentation, Community, Extensions
The good

◼

◼

Image processing, databases, mails,
character encoding, XML built-in
Few keywords and operators, high
readability
The bad

◼
◼

◼

◼

Spaghetti code
Very loose typing: null == false ==
"" == 0 == "0" == array()
Inconsistent code base: strpos(),
str_rot13(), library not OO
Arbitrary filesystem structure
The getting better

◼
◼

◼

OO; Closures, Iterators, Generators
Standard PHP Library (SPL): queues,
stacks, lists, iterators
Tools: PHPUnit, PHPDocumentor, Mess
Detector, Checkstyle
Example

$numbers = array(1, 2, 3, 4, 5);
$divisor = 3;
Old school

$numbers = array(1, 2, 3, 4, 5);
$divisor = 3;

$filtered = array();
foreach ($numbers as $number) {
if ($number % $divisor == 0) {
$filtered[] = $number;
}
}
Middle school

$numbers = array(1, 2, 3, 4, 5);
$divisor = 3;

$filter = create_function('$number', “return
($number % $divisor == 0);”);
$filtered = array_filter($numbers, $filter);
New school

$numbers = array(1, 2, 3, 4, 5);
$divisor = 3;

$filter = function($number) use ($divisor) {
return ($number % $divisor == 0);
};
$filtered = array_filter($numbers, $filter);
Questions?
PHP Frameworks

◼
◼

◼
◼
◼

MVC
OO
ORM
Templates
...
Symfony

◼
◼

◼

MVC, OO
Created by Sensio labs
Documentation, Community, Events
Symfony

◼
◼

◼
◼
◼

URL Conventions
CRUD generators
Doctrine ORM, Twig templates
Loosely coupled components
Dependency injection
Demo Time
Summary

“PHP is the Nickelback of programming
languages”
- Jeff Atwood, Stack Exchange
Summary

“The only conclusion I can draw is that
building a compelling application is far
more important than choice of language”
- Jeff Atwood, Stack Exchange
Thanks!
Backup: Install instructions
1.
2.
3.
4.
5.
6.

Change user: sudo su - www-data -s /bin/bash
Download Symfony 2.3 Standard Edition (without Vendors): http://symfony.com/download
Setup git repository: http://symfony.com/doc/current/cookbook/workflow/new_project_git.html
Install composer: curl -sS https://getcomposer.org/installer | php
Install libraries: php composer.phar install
Configure: http://localhost/~georg/webdev/web/config.php
a.
b.

7.
8.
9.
10.
11.
12.
13.
14.
15.

16.
17.

pdo_sqlite
db path: %kernel.root_dir%/data/example.db

c. no password
Generate bundle: php app/console generate:bundle
Generate entity: php app/console generate:doctrine:entity
Drop the old DB schema: php app/console doctrine:schema:drop --force
Generate DB schema: php app/console doctrine:schema:create
Generate CRUD: php app/console generate:doctrine:crud
http://localhost/~georg/webdev/web/app_dev.php/post/
Add pretty CRUD bundle: https://github.com/jordillonch/CrudGeneratorBundle
Install new bundle: php composer.phar update
Delete the old CRUD: rm -fr src/FINDOLOGIC/ExampleBundle/Resources/views/Post/
src/FINDOLOGIC/ExampleBundle/Controller/PostController.php
src/FINDOLOGIC/ExampleBundle/Form/PostType.php
src/FINDOLOGIC/ExampleBundle/Tests/Controller/PostControllerTest.php
Generate new CRUD: php app/console jordillonch:generate:crud
Fill created_at automatically: http://stackoverflow.com/questions/17321893/automatic-values-for-updated-atcreated-at-in-doctrine

a. Remove created_at from src/FINDOLOGIC/ExampleBundle/Form/PostType.php
18. http://localhost/~georg/webdev/web/app_dev.php/post/
1 of 28

Recommended

Memory Management in WordPress by
Memory Management in WordPressMemory Management in WordPress
Memory Management in WordPressKonstantin Kovshenin
1.5K views60 slides
MongoUK - PHP Development by
MongoUK - PHP DevelopmentMongoUK - PHP Development
MongoUK - PHP DevelopmentBoxed Ice
931 views24 slides
Simple php backdoor_by_dk by
Simple php backdoor_by_dkSimple php backdoor_by_dk
Simple php backdoor_by_dkStan Adrian
797 views1 slide
Wordpress Security 101 by
Wordpress Security 101Wordpress Security 101
Wordpress Security 101Robert Rowley
6.7K views50 slides
Banquet 36 by
Banquet 36Banquet 36
Banquet 36Koubei UED
344 views22 slides
Ansible to provision your machines by
Ansible to provision your machinesAnsible to provision your machines
Ansible to provision your machinesFellipe Callegas
366 views14 slides

More Related Content

What's hot

The Windows 10 tips you wished you knew last week by
The Windows 10 tips you wished you knew last weekThe Windows 10 tips you wished you knew last week
The Windows 10 tips you wished you knew last weekOlav Tvedt
170 views26 slides
Presentation of JSConf.eu by
Presentation of JSConf.euPresentation of JSConf.eu
Presentation of JSConf.euFredrik Wendt
1.8K views25 slides
ModemFrontEndops by
ModemFrontEndopsModemFrontEndops
ModemFrontEndopsmicrobean
73 views51 slides
Laporan setting dns by
Laporan setting dnsLaporan setting dns
Laporan setting dnsSeptian Adi
292 views9 slides
Plone Conference 2008 Lightning Talk Static Zope Rpx by
Plone Conference 2008 Lightning Talk Static Zope RpxPlone Conference 2008 Lightning Talk Static Zope Rpx
Plone Conference 2008 Lightning Talk Static Zope RpxParis, France
808 views14 slides
Plone pwns by
Plone pwnsPlone pwns
Plone pwnsDylan Jay
679 views56 slides

What's hot(7)

The Windows 10 tips you wished you knew last week by Olav Tvedt
The Windows 10 tips you wished you knew last weekThe Windows 10 tips you wished you knew last week
The Windows 10 tips you wished you knew last week
Olav Tvedt170 views
Presentation of JSConf.eu by Fredrik Wendt
Presentation of JSConf.euPresentation of JSConf.eu
Presentation of JSConf.eu
Fredrik Wendt1.8K views
ModemFrontEndops by microbean
ModemFrontEndopsModemFrontEndops
ModemFrontEndops
microbean73 views
Laporan setting dns by Septian Adi
Laporan setting dnsLaporan setting dns
Laporan setting dns
Septian Adi292 views
Plone Conference 2008 Lightning Talk Static Zope Rpx by Paris, France
Plone Conference 2008 Lightning Talk Static Zope RpxPlone Conference 2008 Lightning Talk Static Zope Rpx
Plone Conference 2008 Lightning Talk Static Zope Rpx
Paris, France808 views
Plone pwns by Dylan Jay
Plone pwnsPlone pwns
Plone pwns
Dylan Jay679 views
A practical 10m intro to PHP on Heroku by Olivier Garcia
A practical 10m intro to PHP on HerokuA practical 10m intro to PHP on Heroku
A practical 10m intro to PHP on Heroku
Olivier Garcia519 views

Similar to Salzburg WebDev Meetup PHP Symfony

Ran Mizrahi - Symfony2 meets Drupal8 by
Ran Mizrahi - Symfony2 meets Drupal8Ran Mizrahi - Symfony2 meets Drupal8
Ran Mizrahi - Symfony2 meets Drupal8Ran Mizrahi
2.7K views22 slides
Current state-of-php by
Current state-of-phpCurrent state-of-php
Current state-of-phpRichard McIntyre
607 views73 slides
Unleash your Symfony projects with eZ Platform by
Unleash your Symfony projects with eZ PlatformUnleash your Symfony projects with eZ Platform
Unleash your Symfony projects with eZ PlatformSébastien Morel
2.1K views46 slides
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016 by
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016Cisco DevNet
695 views78 slides
Becoming A Php Ninja by
Becoming A Php NinjaBecoming A Php Ninja
Becoming A Php NinjaMohammad Emran Hasan
4K views28 slides
Introduction to PHP - SDPHP by
Introduction to PHP - SDPHPIntroduction to PHP - SDPHP
Introduction to PHP - SDPHPEric Johnson
687 views49 slides

Similar to Salzburg WebDev Meetup PHP Symfony(20)

Ran Mizrahi - Symfony2 meets Drupal8 by Ran Mizrahi
Ran Mizrahi - Symfony2 meets Drupal8Ran Mizrahi - Symfony2 meets Drupal8
Ran Mizrahi - Symfony2 meets Drupal8
Ran Mizrahi2.7K views
Unleash your Symfony projects with eZ Platform by Sébastien Morel
Unleash your Symfony projects with eZ PlatformUnleash your Symfony projects with eZ Platform
Unleash your Symfony projects with eZ Platform
Sébastien Morel2.1K views
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016 by Cisco DevNet
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016
Cisco DevNet695 views
Introduction to PHP - SDPHP by Eric Johnson
Introduction to PHP - SDPHPIntroduction to PHP - SDPHP
Introduction to PHP - SDPHP
Eric Johnson687 views
Get Ahead with HTML5 on Moible by markuskobler
Get Ahead with HTML5 on MoibleGet Ahead with HTML5 on Moible
Get Ahead with HTML5 on Moible
markuskobler442 views
HTML5 vs Silverlight by Matt Casto
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs Silverlight
Matt Casto4.3K views
Web-Designing Workshop Day 2 by dk201020
Web-Designing Workshop Day 2Web-Designing Workshop Day 2
Web-Designing Workshop Day 2
dk2010201.1K views
Php mysql training-in-mumbai by vibrantuser
Php mysql training-in-mumbaiPhp mysql training-in-mumbai
Php mysql training-in-mumbai
vibrantuser111 views
What Web Framework To Use? by Kasra Khosravi
What Web Framework To Use?What Web Framework To Use?
What Web Framework To Use?
Kasra Khosravi1.1K views
Amplify your stack - Jsfoo pune 2012 by threepointone
Amplify your stack - Jsfoo pune 2012Amplify your stack - Jsfoo pune 2012
Amplify your stack - Jsfoo pune 2012
threepointone742 views
Open source-secret-sauce-rit-2010 by Ted Husted
Open source-secret-sauce-rit-2010Open source-secret-sauce-rit-2010
Open source-secret-sauce-rit-2010
Ted Husted401 views

More from Georg Sorst

Psychological safety how to become a team that learns by
Psychological safety   how to become a team that learnsPsychological safety   how to become a team that learns
Psychological safety how to become a team that learnsGeorg Sorst
946 views22 slides
Interactive Data Science Notebooks with Apache Zeppelin by
Interactive Data Science Notebooks with Apache ZeppelinInteractive Data Science Notebooks with Apache Zeppelin
Interactive Data Science Notebooks with Apache ZeppelinGeorg Sorst
524 views18 slides
JS Error Logging with Sentry by
JS Error Logging with SentryJS Error Logging with Sentry
JS Error Logging with SentryGeorg Sorst
327 views14 slides
Infrastructure = Code by
Infrastructure = CodeInfrastructure = Code
Infrastructure = CodeGeorg Sorst
1.1K views20 slides
Das bedingungslose Grundeinkommen by
Das bedingungslose GrundeinkommenDas bedingungslose Grundeinkommen
Das bedingungslose GrundeinkommenGeorg Sorst
923 views20 slides
ELK Stack - Turn boring logfiles into sexy dashboard by
ELK Stack - Turn boring logfiles into sexy dashboardELK Stack - Turn boring logfiles into sexy dashboard
ELK Stack - Turn boring logfiles into sexy dashboardGeorg Sorst
5.4K views12 slides

More from Georg Sorst(7)

Psychological safety how to become a team that learns by Georg Sorst
Psychological safety   how to become a team that learnsPsychological safety   how to become a team that learns
Psychological safety how to become a team that learns
Georg Sorst946 views
Interactive Data Science Notebooks with Apache Zeppelin by Georg Sorst
Interactive Data Science Notebooks with Apache ZeppelinInteractive Data Science Notebooks with Apache Zeppelin
Interactive Data Science Notebooks with Apache Zeppelin
Georg Sorst524 views
JS Error Logging with Sentry by Georg Sorst
JS Error Logging with SentryJS Error Logging with Sentry
JS Error Logging with Sentry
Georg Sorst327 views
Infrastructure = Code by Georg Sorst
Infrastructure = CodeInfrastructure = Code
Infrastructure = Code
Georg Sorst1.1K views
Das bedingungslose Grundeinkommen by Georg Sorst
Das bedingungslose GrundeinkommenDas bedingungslose Grundeinkommen
Das bedingungslose Grundeinkommen
Georg Sorst923 views
ELK Stack - Turn boring logfiles into sexy dashboard by Georg Sorst
ELK Stack - Turn boring logfiles into sexy dashboardELK Stack - Turn boring logfiles into sexy dashboard
ELK Stack - Turn boring logfiles into sexy dashboard
Georg Sorst5.4K views
Der FINDOLOGIC Entwicklungsprozess by Georg Sorst
Der FINDOLOGIC EntwicklungsprozessDer FINDOLOGIC Entwicklungsprozess
Der FINDOLOGIC Entwicklungsprozess
Georg Sorst872 views

Recently uploaded

Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueShapeBlue
218 views20 slides
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...ShapeBlue
132 views13 slides
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueShapeBlue
222 views7 slides
Business Analyst Series 2023 - Week 4 Session 8 by
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8DianaGray10
123 views13 slides
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOsPriyanka Aash
158 views59 slides
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And... by
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...ShapeBlue
106 views12 slides

Recently uploaded(20)

Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue218 views
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue132 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue222 views
Business Analyst Series 2023 - Week 4 Session 8 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8
DianaGray10123 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash158 views
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And... by ShapeBlue
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
ShapeBlue106 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue238 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue119 views
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue252 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue206 views
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue130 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc170 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue203 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue145 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue180 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li85 views
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue221 views
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue161 views
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by ShapeBlue
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue123 views

Salzburg WebDev Meetup PHP Symfony

  • 1. There are plenty of other frameworks in the sea PHP + Symfony FINDOLOGIC GMBH GEORG M. SORST G.SORST@FINDOLOGIC.COM WebDev Meetup 20.11.2013
  • 2. FINDOLOGIC ◼ ◼ ◼ ◼ Search for online stores >100M queries / month A dozen servers One of Salzburg’s most successful startups
  • 4. LAN
  • 5. BBQ
  • 8. History ◼ ◼ ◼ ◼ Born in the web 20 years ago Form interpreter to replace perl Core is backed by a company (Zend) 1M to 100M hostnames in 10 years
  • 9. Stack Overflow tags Source: http://hewgill.com/~greg/stackoverflow/stack_overflow/tags/
  • 11. Usage ◼ eCommerce: osCommerce, Zen Cart, Magento, PrestaShop, OpenCart, Oxid, xtCommerce, Shopware ◼ CMS: Wordpress, Joomla, Drupal ◼ Other: Wikipedia, Digg, Facebook
  • 12. The good ◼ ◼ ◼ Dead simple: <?php echo “Hello world”; Runs everywhere Documentation, Community, Extensions
  • 13. The good ◼ ◼ Image processing, databases, mails, character encoding, XML built-in Few keywords and operators, high readability
  • 14. The bad ◼ ◼ ◼ ◼ Spaghetti code Very loose typing: null == false == "" == 0 == "0" == array() Inconsistent code base: strpos(), str_rot13(), library not OO Arbitrary filesystem structure
  • 15. The getting better ◼ ◼ ◼ OO; Closures, Iterators, Generators Standard PHP Library (SPL): queues, stacks, lists, iterators Tools: PHPUnit, PHPDocumentor, Mess Detector, Checkstyle
  • 16. Example $numbers = array(1, 2, 3, 4, 5); $divisor = 3;
  • 17. Old school $numbers = array(1, 2, 3, 4, 5); $divisor = 3; $filtered = array(); foreach ($numbers as $number) { if ($number % $divisor == 0) { $filtered[] = $number; } }
  • 18. Middle school $numbers = array(1, 2, 3, 4, 5); $divisor = 3; $filter = create_function('$number', “return ($number % $divisor == 0);”); $filtered = array_filter($numbers, $filter);
  • 19. New school $numbers = array(1, 2, 3, 4, 5); $divisor = 3; $filter = function($number) use ($divisor) { return ($number % $divisor == 0); }; $filtered = array_filter($numbers, $filter);
  • 22. Symfony ◼ ◼ ◼ MVC, OO Created by Sensio labs Documentation, Community, Events
  • 23. Symfony ◼ ◼ ◼ ◼ ◼ URL Conventions CRUD generators Doctrine ORM, Twig templates Loosely coupled components Dependency injection
  • 25. Summary “PHP is the Nickelback of programming languages” - Jeff Atwood, Stack Exchange
  • 26. Summary “The only conclusion I can draw is that building a compelling application is far more important than choice of language” - Jeff Atwood, Stack Exchange
  • 28. Backup: Install instructions 1. 2. 3. 4. 5. 6. Change user: sudo su - www-data -s /bin/bash Download Symfony 2.3 Standard Edition (without Vendors): http://symfony.com/download Setup git repository: http://symfony.com/doc/current/cookbook/workflow/new_project_git.html Install composer: curl -sS https://getcomposer.org/installer | php Install libraries: php composer.phar install Configure: http://localhost/~georg/webdev/web/config.php a. b. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. pdo_sqlite db path: %kernel.root_dir%/data/example.db c. no password Generate bundle: php app/console generate:bundle Generate entity: php app/console generate:doctrine:entity Drop the old DB schema: php app/console doctrine:schema:drop --force Generate DB schema: php app/console doctrine:schema:create Generate CRUD: php app/console generate:doctrine:crud http://localhost/~georg/webdev/web/app_dev.php/post/ Add pretty CRUD bundle: https://github.com/jordillonch/CrudGeneratorBundle Install new bundle: php composer.phar update Delete the old CRUD: rm -fr src/FINDOLOGIC/ExampleBundle/Resources/views/Post/ src/FINDOLOGIC/ExampleBundle/Controller/PostController.php src/FINDOLOGIC/ExampleBundle/Form/PostType.php src/FINDOLOGIC/ExampleBundle/Tests/Controller/PostControllerTest.php Generate new CRUD: php app/console jordillonch:generate:crud Fill created_at automatically: http://stackoverflow.com/questions/17321893/automatic-values-for-updated-atcreated-at-in-doctrine a. Remove created_at from src/FINDOLOGIC/ExampleBundle/Form/PostType.php 18. http://localhost/~georg/webdev/web/app_dev.php/post/