Why is PHP Awesome

6,689 views

Published on

University of Manchester: COMP101 Guest Lecture Monday 10th March, 11am Kilburn LT1.1

This talk will argue that PHP's bad reputation is a thing of the past and look at where and how PHP is used in the wild. We will describe some really useful tools and libraries which people can take away and play with. We will touch on the jobs market for PHP, agency working and how to get involved. We will finally talk about the huge community for PHP around the world but also specifically in Manchester.

Speaker Biographies: Steph Cook @steph_cook22 and Damien Walsh @themainframe are web developers @magma_digital and recent graduates of @csmcr. Jeremy Coates @phpcodemonkey is the Managing Director of Magma Digital, the leading software development agency in Lancashire.

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

No Downloads
Views
Total views
6,689
On SlideShare
0
From Embeds
0
Number of Embeds
26
Actions
Shares
0
Downloads
20
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Why is PHP Awesome

  1. 1. Why PHP Is Awesome Honest. @magma_digital
  2. 2. The Team @magma_digital
  3. 3. Speaking today Jeremy Coates @phpcodemonkey @magma_digital Steph Cook @stephcook22 Damien Walsh @themainframe
  4. 4. “PHP is used by 81.8% of all the websites whose server-side programming language we know.” – w3techs.com @magma_digital
  5. 5. @magma_digital
  6. 6. So why the reputation @magma_digital
  7. 7. PHP has moved on. @magma_digital
  8. 8. The dark ages… @magma_digital
  9. 9. //genearate a filename...
 $fn_temp = preg_replace("/[^a-zA-Z0-9s]/", "", $_POST[‘f_n’]); Magic strings… //Does it exist?
 while(file_exists("/home/cocoder/.data/{$fn_temp}{$n}/"))
 $n++; ?>
 <h1>Project Created!</h1> 
 <?php
 Suddenly… HTML 
 //DB...
 $return_id = cc_core::make_project(
 $_POST['n_name'],
 i ($fn_temp.$n),
 $_SESSION['user_id']
 );
 
 ?> @magma_digital Highly procedural
  10. 10. Now… @magma_digital
  11. 11. public function editAction(Request $request)
 {
 $this->form->handleRequest($request);
 $entity = $this->form->getData(); Interact with Model if ($this->form->isValid()) {
 $this->em = $this->doctrine->getManager();
 $this->em->persist($entity);
 $this->em->flush();
 }
 
 } return $this->render(
 ‘TestBundle:Items:edit.html.twig',
 array(
 'entity' => $entity,
 'form' => $this->form->createView()
 )
 );
 @magma_digital Render View
  12. 12. The cool stuff To make your projects easier @magma_digital
  13. 13. @magma_digital
  14. 14. Composer curl -sS https://getcomposer.org/installer | php @magma_digital
  15. 15. Composer composer.json: {
 "require": {
 "monolog/monolog": "1.2.*"
 }
 } @magma_digital
  16. 16. Composer include include include include include @magma_digital ‘classes/Foo.class.php’;
 ‘classes/Bar.class.php’;
 ‘classes/OtherStuff.class.php’;
 ‘classes/MyClass.class.php’;
 ‘classes/AnotherClass.class.php’;
  17. 17. Composer include ‘vendor/autoload.php’; ...
 
 $foo = new Foo(); @magma_digital
  18. 18. Silex @magma_digital
  19. 19. Silex composer.json: {
 } @magma_digital "require": {
 "silex/silex": "~1.1"
 }

  20. 20. Silex Fire up composer. require_once __DIR__ . '/../vendor/autoload.php'; $app = new SilexApplication(); Create the App $app->get('/hello/{name}', function($name) use($app) { return 'Hello '.$app->escape($name); }); $app->run(); @magma_digital Be safe! Run it. Add a route
  21. 21. Twig @magma_digital
  22. 22. Twig <ul> {% for user in users %}
 <li> {{ user.name }} </li>
 {% else %}
 <li>
 <strong>No users have been found.</strong>
 </li>
 {% endfor %} </ul> @magma_digital
  23. 23. @magma_digital
  24. 24. Xdebug! Install the extension Install the browser extension Setup for integration with IDE (NetBeans, PHPStorm) Press Play Refresh your page Profit @magma_digital
  25. 25. Codeception @magma_digital
  26. 26. Codeception $I = new WebGuy($scenario);
 $I->wantTo('create a wiki page');
 $I->amOnPage('/');
 $I->click('Pages');
 $I->click('New');
 $I->see('New Page'); @magma_digital
  27. 27. Full Stack Frameworks Symfony2 & Zend Framework 2 @magma_digital
  28. 28. @magma_digital
  29. 29. @magma_digital
  30. 30. Types of Projects @magma_digital
  31. 31. @magma_digital
  32. 32. Manchester Digital has revealed that 32% of digital organisations in the region were forced to refuse work in 2013 due to a lack of resource, despite 83% of businesses experiencing growth. @magma_digital
  33. 33. Get involved! @magma_digital
  34. 34. @magma_digital
  35. 35. PHPNW @magma_digital
  36. 36. Have we convinced you yet @magma_digital
  37. 37. All resources over here:! http://bit.ly/phpawesome @magma_digital

×