Slide 1

Slide 1 text

Good ol’PHP @rapzo - may 18th - 2016 A tale on how to turn hate into love

Slide 2

Slide 2 text

Rui Lima front-end developer @blippt Jack of all trades @exoticosembraga @rapzo github.com/rapzo @rapzo - may 18th - 2016

Slide 3

Slide 3 text

PHP SUCKS!!1

Slide 4

Slide 4 text

PHP stands for… Personal Home Page……… We came a loooong way Now it’s PHP: Hypertext Preprocessor... @rapzo - may 18th - 2016

Slide 5

Slide 5 text

Back in the later 1990s and early 2000 php was the lingua franca for web development But it was bugged as hell @rapzo - may 18th - 2016

Slide 6

Slide 6 text

php 5.3 came out and php-fig was created!! @rapzo - may 18th - 2016 2009

Slide 7

Slide 7 text

psr-1 coding standards (who gives a damn) psr-2 code style (srsly?!?!) psr-3 LoggerInterface psr-4 ex-psr-0, the autoloading standard psr-6 CacheInterface (alright…) psr-7 http message interface (aleluia!!) @rapzo - may 18th - 2016 php-fig

Slide 8

Slide 8 text

First community adopted package manager for PHP. Like many others, relies on github to solve its dependencies @rapzo - may 18th - 2016 composer

Slide 9

Slide 9 text

@rapzo - may 18th - 2016

Slide 10

Slide 10 text

@rapzo - may 18th - 2016 composer packagist is your friend!

Slide 11

Slide 11 text

Yeah, this is like, what every other language already has...

Slide 12

Slide 12 text

@rapzo - may 18th - 2016 language features from php 5.3 onwards… the others are rubbish anyways... 5.3 the biggest leap 5.4 array shorthands, traits and a webserver! 5.5 generators (i yield!) and expressions in primitives 5.6 constant expressions, …$params notation 5.7 when everybody went bananas! long wait.... 7.0 major shift

Slide 13

Slide 13 text

@rapzo - may 18th - 2016 php 5.3 namespaces for logically code separation late static binding for static inheritance closures don’t we just love to provide functions as arguments! nowdoc & heredoc output buffered content constants immutable data FTW! shorthand ternary ?: ‘hello’; dynamic access to static $a::$b \m/

Slide 14

Slide 14 text

@rapzo - may 18th - 2016 php 5.3 namespaces for logically code separation

Slide 15

Slide 15 text

@rapzo - may 18th - 2016 php 5.3 late static binding for static inheritance

Slide 16

Slide 16 text

@rapzo - may 18th - 2016 php 5.3 closures don’t we just love to provide functions as arguments!

Slide 17

Slide 17 text

@rapzo - may 18th - 2016 php 5.3 nowdoc & heredoc output buffered content

Slide 18

Slide 18 text

@rapzo - may 18th - 2016 php 5.3 constants immutable data FTW!

Slide 19

Slide 19 text

@rapzo - may 18th - 2016 php 5.3 shorthand ternary ?: ‘hello’;

Slide 20

Slide 20 text

@rapzo - may 18th - 2016 php 5.3 dynamic access to static $a::$b \m/

Slide 21

Slide 21 text

@rapzo - may 18th - 2016 php 5.4 traits for class decoration array short syntax no more array(‘a’ => ‘b’) function array deref hello()[0] closures can have a scope short open tags for echoing always available instantiating access (new ABC)->a()->b()->c() Class::{expressions} awesome! binary is now available session track for upload hooray progress bars webserver aleluia!

Slide 22

Slide 22 text

@rapzo - may 18th - 2016 php 5.4 traits for class decoration

Slide 23

Slide 23 text

@rapzo - may 18th - 2016 php 5.4 array short syntax no more array(‘a’ => ‘b’)

Slide 24

Slide 24 text

@rapzo - may 18th - 2016 php 5.4 function array deref hello()[0]

Slide 25

Slide 25 text

@rapzo - may 18th - 2016 php 5.4 closures can have a scope

Slide 26

Slide 26 text

@rapzo - may 18th - 2016 php 5.4 short open tags for echoing always available

Slide 27

Slide 27 text

@rapzo - may 18th - 2016 php 5.4 instantiating access (new ABC)->a()->b()->c()

Slide 28

Slide 28 text

@rapzo - may 18th - 2016 php 5.4 Class::{expressions} awesome!

Slide 29

Slide 29 text

@rapzo - may 18th - 2016 php 5.4 binary is now available

Slide 30

Slide 30 text

@rapzo - may 18th - 2016 php 5.4 session track for upload hooray progress bars

Slide 31

Slide 31 text

@rapzo - may 18th - 2016 php 5.4 webserver aleluia!

Slide 32

Slide 32 text

@rapzo - may 18th - 2016 php 5.5 generators multiple results from the same function finally who haven’t discard an exception before primitives accept functions such as foreach empty() accepts expressions, like functions dereferencing for arrays and strings ::class for dynamic class name access OPcache for precompiled code storage

Slide 33

Slide 33 text

@rapzo - may 18th - 2016 php 5.5 generators multiple results from the same function

Slide 34

Slide 34 text

@rapzo - may 18th - 2016 php 5.5 finally who haven’t discard an exception before

Slide 35

Slide 35 text

@rapzo - may 18th - 2016 php 5.5 primitives accept functions such as foreach

Slide 36

Slide 36 text

@rapzo - may 18th - 2016 php 5.5 empty() accepts expressions, like functions

Slide 37

Slide 37 text

@rapzo - may 18th - 2016 php 5.5 dereferencing for arrays and strings

Slide 38

Slide 38 text

@rapzo - may 18th - 2016 php 5.5 ::class for dynamic class name access

Slide 39

Slide 39 text

@rapzo - may 18th - 2016 php 5.5 OPcache for precompiled code storage

Slide 40

Slide 40 text

@rapzo - may 18th - 2016 php 5.6 const expressions sometimes constants are not just constants const arrays heheh told ya! ... Rest params via array! Awesome! ...$params and spreading exponentiation right to left, never forget! use syntax for functions and constants via namespaces Class::__debugInfo for class var_dump

Slide 41

Slide 41 text

@rapzo - may 18th - 2016 php 5.6 const expressions sometimes constants are not just constants

Slide 42

Slide 42 text

@rapzo - may 18th - 2016 php 5.6 const arrays heheh told ya!

Slide 43

Slide 43 text

@rapzo - may 18th - 2016 php 5.6 ... Rest params via array! Awesome!

Slide 44

Slide 44 text

@rapzo - may 18th - 2016 php 5.6 ...$params and spreading

Slide 45

Slide 45 text

@rapzo - may 18th - 2016 php 5.6 exponentiation right to left, never forget!

Slide 46

Slide 46 text

@rapzo - may 18th - 2016 php 5.6 use syntax for functions and constants via namespaces

Slide 47

Slide 47 text

@rapzo - may 18th - 2016 php 5.6 Class::__debugInfo for class var_dump

Slide 48

Slide 48 text

@rapzo - may 18th - 2016 php 7.0 types for function arguments more types for return declarations null or bust isset($a) ? $a : ‘a’ = $a ?? ‘a’ spaceship op echo -1 <=> 1 good ol’define for arrays anonymous classes fire and forget! Closure::call() hello late closure calls assert() expectations, finally! use just got javascript’d use \some\{A,B,C}

Slide 49

Slide 49 text

@rapzo - may 18th - 2016 php 7.0 types for function arguments

Slide 50

Slide 50 text

@rapzo - may 18th - 2016 php 7.0 more types for return declarations

Slide 51

Slide 51 text

@rapzo - may 18th - 2016 php 7.0 null or bust isset($a) ? $a : ‘a’ = $a = $a ?? ‘a’

Slide 52

Slide 52 text

@rapzo - may 18th - 2016 php 7.0 spaceship op echo -1 <=> 1

Slide 53

Slide 53 text

@rapzo - may 18th - 2016 php 7.0 good ol’define for arrays

Slide 54

Slide 54 text

@rapzo - may 18th - 2016 php 7.0 anonymous classes fire and forget!

Slide 55

Slide 55 text

@rapzo - may 18th - 2016 php 7.0 Closure::call() hello late closure calls

Slide 56

Slide 56 text

@rapzo - may 18th - 2016 php 7.0 assert() expectations, finally!

Slide 57

Slide 57 text

@rapzo - may 18th - 2016 php 7.0 use just got javascript’d use \some\{A,B,C}

Slide 58

Slide 58 text

@rapzo - may 18th - 2016 HHVM php got sideways before announcing the 6th version, which made facebook develop its own virtual machine HHVM is a JIT compiler to bytecode and virtual machine that runs that bytecode

Slide 59

Slide 59 text

@rapzo - may 18th - 2016 HHVM HHVM is not a replacement for php although it has a new language, strong typed, called Hack HHVM supports php and is 99,9% with the 7th version

Slide 60

Slide 60 text

@rapzo - may 18th - 2016 HHVM and PHP In terms of performance, they are both fast In terms of deployment, HHVM is metal greedy

Slide 61

Slide 61 text

@rapzo - may 18th - 2016 Next time... The real talk about php apps, laravel, lumen and building something!

Slide 62

Slide 62 text

thank you!

Slide 63

Slide 63 text

?