Slide 1

Slide 1 text

YOUR PERFECT TOOL Presented by / Milan Popović @komita1981

Slide 2

Slide 2 text

ME PHP developer 7 years in PHP development Work for 12 Mnkys I like to learn and share knowledge Active member of PHP Srbija

Slide 3

Slide 3 text

YOU? Who are you? What's your experience in programming? What do you think about PHP?

Slide 4

Slide 4 text

“There are only two kinds of programming languages: those people always bitch about and those nobody uses.” Bjarne Stroustrup

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

HISTORY OF PHP Created in 1994 by Rasmus Lerdorf - @rasmus Written in C Personal Home Page Tools ZEND - Andi Gutmans and Zeev Suraski PHP - Hypertext Preprocessor

Slide 7

Slide 7 text

TIMELINE PHP 1 - 1995 PHP 2 - 1996 PHP 3 - 1998 - popularity gained PHP 4 - 2000 - wannabe object PHP 5 - 2004 - OO support PHP 5.3 - 2009 - Namespaces PHP 5.4 - 2012 - Traits, [] PHP 5.5 - 2013 - OPcache, Finally PHP 5.6 - 2014 - Constant Scalar Expressions PHP 7 - October 2015

Slide 8

Slide 8 text

May 2014 - PHP github repo April 2015 - PHP github repo

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

WHY YOU SHOULD CHOOSE PHP?

Slide 17

Slide 17 text

HOSTING Shared VPS Dedicated servers Heroku Google App Engine Azure

Slide 18

Slide 18 text

POPULARITY - TIOBE INDEX

Slide 19

Slide 19 text

Popularity - usage of languages on web

Slide 20

Slide 20 text

COMMUNITY More than 5 millions PHP developers worldwide Up to thousand PHP developers in Serbia

Slide 21

Slide 21 text

ACTIVITY

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Simplicity - Highly learnable The easiest language to learn for non-technical people Fast and reliable Platform independent Bunch of good tools Bunch of extensions Good (and extensive) documentation Big players involved (FB...) Open source Lets you get things done

Slide 25

Slide 25 text

PREJUDICE

Slide 26

Slide 26 text

Tim Bray “All the PHP code I’ve seen in that experience has been messy, unmaintainable crap. Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML, replicated in slightly- varying form in dozens of places”

Slide 27

Slide 27 text

namespace League\Flysystem; use LogicException; use InvalidArgumentException; class Filesystem implements FilesystemInterface { // variable declaration hidden in this example /** * Constructor * * @param AdapterInterface $adapter * @param mixed $config */ public function __construct(AdapterInterface $adapter, $config = null)

Slide 28

Slide 28 text

EDUCATION

Slide 29

Slide 29 text

PHP THE RIGHT WAY

Slide 30

Slide 30 text

LARACAST

Slide 31

Slide 31 text

BOOKS http://php-books.com/

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

CONFERENCES

Slide 36

Slide 36 text

PHP FIG PHP Framework Interop Group

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

PSR Php Standard Recommendation PSR-0 - Autoloading standard PSR-1 - Basic coding standard PSR-2 - Coding style guide PSR-3 - Logger interface PSR-4 - Improved autoloading PSR-5 - PHPDoc PSR-6 - Cache interface PSR-7 - HTTP message implementation

Slide 39

Slide 39 text

COMPOSER Dependency Manager for PHP Created by Jordi Boggiano and Nils Adermann Thank you guys!

Slide 40

Slide 40 text

Fabien Potencier “PHP has a better dependency manager than any other languages”

Slide 41

Slide 41 text

curl -sS https://getcomposer.org/installer | php Can be installed globally and locally

Slide 42

Slide 42 text

The problem that Composer solves is this: You have a project that depends on a number of libraries Some of those libraries depend on other libraries You declare the things you depend on Composer finds out which versions of which packages need to be installed, and installs them (meaning it downloads them into your project)

Slide 43

Slide 43 text

Declaring dependencies composer.json { "name": "zendframework/skeleton-application", "description": "Skeleton Application for ZF2", "license": "BSD-3-Clause", "keywords": [ "framework", "zf2" ], "homepage": "http://framework.zend.com/", "require": { "php": ">=5.3.3", "zendframework/zendframework": "2.2.*", "aws/aws-sdk-php-zf2": "1.2.1", "league/flysystem": "0.4.*@dev" } }

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

SEMANTIC VERSIONING more info - http://semver.org/

Slide 46

Slide 46 text

VERSION CONSTRAINTS

Slide 47

Slide 47 text

EXACT MATCH 1.0.0, dev-master

Slide 48

Slide 48 text

WILDCARD RANGE 1.0.*, 2.*

Slide 49

Slide 49 text

HYPHEN RANGE 1.0 - 2.0 === >=1.0.0 < 2.1 1.0.0 - 2.1.0 === >=1.0.0 <= 2.1.0

Slide 50

Slide 50 text

UNBOUNDED RANGE >= 1.0 DO NOT USE THIS

Slide 51

Slide 51 text

NEXT SIGNIFICANT RELEASE ~1.2 === >=1.2.0 <2.0.0 ~1.2.3 === >=1.2.3 <1.3.0

Slide 52

Slide 52 text

CARET / SEMVER OPERATOR ^1.2.3 === >=1.2.3 <2.0.0 ^ 0.3 === >=0.3.0 <0.4.0 Libraries should use ^ and you should too!

Slide 53

Slide 53 text

THE LOCK FILE composer.lock Provide fast installs with low memory usage Reproducible installs Do you add it to .gitignore? Commit it and use it with composer install

Slide 54

Slide 54 text

DO NOT DEPLOY IT

Slide 55

Slide 55 text

AUTOLOADING You don’t have to maintain your own autoloader Ability to load your code automatically include "vendor/autoload.php";

Slide 56

Slide 56 text

"autoload": { "psr-0" : { "Application": "src/" } }

Slide 57

Slide 57 text

"autoload": { "psr-4" : { "Application\\": "src/" } }

Slide 58

Slide 58 text

"autoload": { "classmap" : [ "src/" ] }

Slide 59

Slide 59 text

$baseDir . '/src/Application/Cont 'Application\\Controller\\Defaults' => $baseDir . '/src/Application/Control 'Application\\Controller\\Entry' => $baseDir . '/src/Application/Controller 'Application\\Controller\\Logbook' => $baseDir . '/src/Application/Controll 'Application\\Controller\\RequiresAuth' => $baseDir . '/src/Application/Con 'Application\\Controller\\User' => $baseDir . '/src/Application/Controller/ 'Application\\Model\\LogEntry\\Defaults' => $baseDir . '/src/Application/Mo 'Application\\Model\\LogEntry\\Gateway' => $baseDir . '/src/Application/Mod

Slide 60

Slide 60 text

{ "require": { "vendor/package": "1.3.2", "vendor/package2": "1.*", "vendor/package3": ">=2.0.3" } }

Slide 61

Slide 61 text

PACKAGIST STATISTICS - MAY 2014 29 908 packages registered 110 247 versions available 207 357 630 packages installed (since 2012-04-13)

Slide 62

Slide 62 text

PACKAGIST STATISTICS - APRIL 2015 56 164 packages registered 246 789 versions available 687 988 359 packages installed (since 2012-04-13)

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

https://github.com/ziadoz/awesome-php

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

BEFORE YOU CHOOSE PACKAGE Check if it is properly tested Check documentation (README.md) Check Stability dev -> alpha -> beta -> RC -> stable Check number of downloads Check when it was last authored Check the licence

Slide 68

Slide 68 text

PHP FRAMEWORKS

Slide 69

Slide 69 text

Zend Framework 2 Symfony 2 Laravel 4, 5 Yii 2 CakePHP 3 Aura

Slide 70

Slide 70 text

PhalconPhp Slim Silex Lumen

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

TAKE CARE ABOUT THIS What do you want to build? Is good documentation available? Is it worth the investment? Community Comparing with other FW Check the licence Security

Slide 73

Slide 73 text

3 DONT'S Don't spend countless hours in search of the „best“ framework. There is no such thing! Don't get religious with a language / framework / whatever! Don't decide based on stupid „hello world“ benchmarks.

Slide 74

Slide 74 text

SYMFONY 2 “If you have a PHP problem the Symfony community has already solved it”

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

There is bundle for everything Integrates with Doctrine, Propel, PHPUnit ... Aims to speed up the creation and maintenance of web applications Aim at building enterprise-level applications, giving developers full control over the configuration

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

LARAVEL The Swiss-Knife of Startup world The Most Popular FW of 2015 FW with the best marketing

Slide 80

Slide 80 text

Symfony components used by Laravel

Slide 81

Slide 81 text

Database agnostic migrations and schema builder Great ORM - Eloquent Painless routing Blade Templating Engine Powerful queue library Validation Built with testing in mind

Slide 82

Slide 82 text

LARAVEL ECOSYSTEM Forge Homestead Elixir Envoyer Laracast

Slide 83

Slide 83 text

PHALCONPHP "The fastest framework"

Slide 84

Slide 84 text

Implemented as a C extension Learning curve is pretty easy Support Micro and Macro application Loosely coupled to allow developers to use the whole framework or selected objects Neat and clean intuitive API with solid code written on powerful design patterns

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

PHP IS NOT FOR Building command line apps Doing heavy calculation Calculate statistics You need all the performance you can get

Slide 87

Slide 87 text

THANK YOU

Slide 88

Slide 88 text

QUESTIONS?