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

FINDOLOGIC GMBH
GEORG M. SORST
G.SORST@FINDOLOGIC.COM
WebDe...
FINDOLOGIC

◼
◼

◼
◼

Search for online stores
>100M queries / month
A dozen servers
One of Salzburg’s most successful sta...
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 ...
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, Joom...
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
read...
The bad

◼
◼

◼

◼

Spaghetti code
Very loose typing: null == false ==
"" == 0 == "0" == array()
Inconsistent code base: s...
The getting better

◼
◼

◼

OO; Closures, Iterators, Generators
Standard PHP Library (SPL): queues,
stacks, lists, iterato...
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 ($numb...
Middle school

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

$filter = create_function('$number', “return
($number % $di...
New school

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

$filter = function($number) use ($divisor) {
return ($number %...
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 in...
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 la...
Thanks!
Backup: Install instructions
1.
2.
3.
4.
5.
6.

Change user: sudo su - www-data -s /bin/bash
Download Symfony 2.3 Standard...
Upcoming SlideShare
Loading in …5
×

Salzburg WebDev Meetup PHP Symfony

1,380 views

Published on

A short introduction to PHP and Symfony

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,380
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Salzburg WebDev Meetup PHP Symfony

  1. 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. 2. FINDOLOGIC ◼ ◼ ◼ ◼ Search for online stores >100M queries / month A dozen servers One of Salzburg’s most successful startups
  3. 3. Business
  4. 4. LAN
  5. 5. BBQ
  6. 6. Trachty Friday
  7. 7. We’re hiring DEVELOPERS DEVELOPERS DEVELOPERS!
  8. 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. 9. Stack Overflow tags Source: http://hewgill.com/~greg/stackoverflow/stack_overflow/tags/
  10. 10. W3Techs Source: http://w3techs.com/technologies/overview/programming_language/all
  11. 11. Usage ◼ eCommerce: osCommerce, Zen Cart, Magento, PrestaShop, OpenCart, Oxid, xtCommerce, Shopware ◼ CMS: Wordpress, Joomla, Drupal ◼ Other: Wikipedia, Digg, Facebook
  12. 12. The good ◼ ◼ ◼ Dead simple: <?php echo “Hello world”; Runs everywhere Documentation, Community, Extensions
  13. 13. The good ◼ ◼ Image processing, databases, mails, character encoding, XML built-in Few keywords and operators, high readability
  14. 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. 15. The getting better ◼ ◼ ◼ OO; Closures, Iterators, Generators Standard PHP Library (SPL): queues, stacks, lists, iterators Tools: PHPUnit, PHPDocumentor, Mess Detector, Checkstyle
  16. 16. Example $numbers = array(1, 2, 3, 4, 5); $divisor = 3;
  17. 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. 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. 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);
  20. 20. Questions?
  21. 21. PHP Frameworks ◼ ◼ ◼ ◼ ◼ MVC OO ORM Templates ...
  22. 22. Symfony ◼ ◼ ◼ MVC, OO Created by Sensio labs Documentation, Community, Events
  23. 23. Symfony ◼ ◼ ◼ ◼ ◼ URL Conventions CRUD generators Doctrine ORM, Twig templates Loosely coupled components Dependency injection
  24. 24. Demo Time
  25. 25. Summary “PHP is the Nickelback of programming languages” - Jeff Atwood, Stack Exchange
  26. 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
  27. 27. Thanks!
  28. 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/

×