PHP

The Right Way

Gracias

David Flores

Linux, Drupal, Symfony, Silex, BackEnd, Seguridad, Python, Open Source, Future Father ...sometimes #Nerd Speaker

david@indava.com

@dmouse

http://bit.ly/meetup-php-01

The old PHP

Includes EVERYWHERE

  • PHP Template
  • mysql_connect
  • var_dump / print_r
  • It works don't touch it
  • Functions, functions and more functions

I'll make my own *

 because i have more control.

Versions

PHP 5.3 Last release Aug 2014

PHP 5.2 Last release Jan 2011

PHP 5.0 Last release Sep 2005

PHP 4.4 Last release Aug 2008

any programming language can misspell.

even more if we strive.

New Features

5.4 - 5.6

Namespace

<?php

use MyPackage\Controller\Login;
use MyPackage\Model\User

Trait

<?php

namespace MyPackage\Traits;

trait message
{
  function showMessage(){ // ... }
}

OOP

<?php

namespace MyPackage;

use MyPackage\Traits\Message;

class Information
{

  use Message;
  
  // ...
}

$inf = new Information();
$inf->showMessage();

yield

<?php

for ($iterator = 1; $i <= 3; $i++) {
    yield $iterator;
}

foreach ($iterator as $value) {
    echo $value;
}

The right way

  • PHP FIG
  • Composer
  • Dependency Injection
  • Testing
    • Unit testing
    • BDD
    • TDD
  • Continuous integration
  • Vagrant / Docker
    • Ansible
    • Puppet

The right way

  • Doctrine
  • OpCache
  • Xdebug
  • Designs patterns
  • HHVM

Resources

  • http://www.phptherightway.com
  • http://www.garfieldtech.com/blog/off-the-island-2013
  • http://grossi.io/2013/why-you-should-use-composer-and-how-to-start-using-it
  • http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part-1
  • http://php-and-symfony.matthiasnoback.nl

What is the next?

Monthly meetup

  • four topics by meetup
  • 15 minutes by speaker
  • Chelas y pizza!

Join us

david@indava.com

@dmouse

www.meetup.com/PHP-The-Right-Way

PHP The Right way | 01

By David Flores

PHP The Right way | 01

  • 1,820