Slide 1

Slide 1 text

MODERN PHP TOOLS & CONCEPTS @Thomas Weinert

Slide 2

Slide 2 text

TOOLS

Slide 3

Slide 3 text

IDES Eclipse Komodo Netbeans PHPStorm ...

Slide 4

Slide 4 text

VCS GIT Subversion

Slide 5

Slide 5 text

COLLABORATION Bitbucket GitHub Sourceforge

Slide 6

Slide 6 text

GITLAB

Slide 7

Slide 7 text

COMPOSER { "name": "carica/chip", "type": "library", "license": "MIT", "require": { "php": ">=5.4", "carica/firmata": "dev-master" }, "require-dev": { "phake/phake": "1.*" }, "autoload": { "psr-4": { "Carica\\Chip\\": "src\\" } } }

Slide 8

Slide 8 text

PACKAGIST

Slide 9

Slide 9 text

SATIS

Slide 10

Slide 10 text

PHAR

Slide 11

Slide 11 text

PHPUNIT Ide Integration Mockery Phake Prophecy

Slide 12

Slide 12 text

BEHAT PHPSPEC

Slide 13

Slide 13 text

PHING

Slide 14

Slide 14 text

DEBUGGER Xdebug PHPDbg

Slide 15

Slide 15 text

PROFILER Xdebug XHProf

Slide 16

Slide 16 text

CODE QUALITY

Slide 17

Slide 17 text

phpdepend phpmd phpcpd phploc

Slide 18

Slide 18 text

PHP METRICS http://halleck45.github.io/PhpMetrics/

Slide 19

Slide 19 text

SCRUNTINIZER CI https://scrutinizer-ci.com/

Slide 20

Slide 20 text

SENSIOLABSINSIHGT https://insight.sensiolabs.com

Slide 21

Slide 21 text

ENGINES PHP (Zend Engine) PHPNG HHVM

Slide 22

Slide 22 text

ZEPHYR http://zephir-lang.com namespace MyLibrary; class Filter { public function alpha(string str) { char ch; string filtered = ""; for ch in str { if (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') { let filtered .= ch; } } return filtered; } }

Slide 23

Slide 23 text

ZEPHYR http://zephir-lang.com $filter = new MyLibrary\Filter(); echo $filter->alpha("01he#l.lo?/1");

Slide 24

Slide 24 text

PHP-CPP http://www.php-cpp.com/ Php::Value my_plus(Php::Parameters ¶meters) { return (int)parameters[0] + (int)parameters[1]; }

Slide 25

Slide 25 text

FEATURES

Slide 26

Slide 26 text

NAMESPACES PSR-4

Slide 27

Slide 27 text

ANONYMOUS FUNCTIONS $board ->activate() ->done( function () use ($board, $loop) { $pin = $board->pins[13]; $pin->mode = Firmata\Board::PIN_MODE_OUTPUT; $loop->setInterval( function () use ($pin) { $pin->digital = !$pin->digital; }, 1000 ); } );

Slide 28

Slide 28 text

CALLABLE $_ = FluentDOM::create(); $_->formatOutput = true; echo $_( 'ul', ['class' => 'navigation'], $_('li', $_->cdata('FluentDOM')) );

Slide 29

Slide 29 text

TRAITS namespace Carica\Io\Event\Loop { use Carica\Io\Event; trait Aggregation { private $_eventLoop = NULL; public function loop(Event\Loop $loop = NULL) { if (NULL !== $loop) { $this->_eventLoop = $loop; } elseif (NULL === $this->_eventLoop) { $this->_eventLoop = Factory::get(); } return $this->_eventLoop; } } }

Slide 30

Slide 30 text

PASSWORD API password_hash() password_verify() password_needs_rehash() password_get_info()

Slide 31

Slide 31 text

OPCACHE

Slide 32

Slide 32 text

DATETIME / DATETIMEIMMUTABLE

Slide 33

Slide 33 text

EXT/INTL

Slide 34

Slide 34 text

MYSQLND

Slide 35

Slide 35 text

SYNTAX

Slide 36

Slide 36 text

ARRAYS function()[key] $array = [1, 2, 3]

Slide 37

Slide 37 text

GENERATORS function xrange($start, $limit, $step = 1) { for ($i = $start; $i <= $limit; $i += $step) { yield $i; } }

Slide 38

Slide 38 text

::CLASS $object::CLASS CLASSNAME::CLASS

Slide 39

Slide 39 text

CONSTANT EXPRESSION const SECONDS = self::DAYS * 86400

Slide 40

Slide 40 text

VARIADICS function f($req, $opt = null, ...$params) { printf( '$req: %d; $opt: %d; number of params: %d'."\n", $req, $opt, count($params) ); } f(1); f(1, 2); f(1, 2, 3);

Slide 41

Slide 41 text

ARGUMENT UNPACKING function add($a, $b, $c) { return $a + $b + $c; } $operators = [2, 3]; echo add(1, ...$operators);

Slide 42

Slide 42 text

THANKS