Enterprise PHP with Symfony2

49
Enterprise PHP WITH SYMFONY2

Transcript of Enterprise PHP with Symfony2

Enterprise PHPWITH SYMFONY2

2

Who am I Eduard Trayan Software engineer Stream coordinator at TC of Belarusian HTP Zend PHP 5.3 Certified developer SensioLabs Certified Symfony Developer [email protected] eduard.trayan

3

Agenda Enterprise software PHP role in enterprise software Why symfony was created for enterprise? Example of project structure & workflow

4

Enterprise software

5

Definition #1 Purpose-designed computer software. Satisfying the needs of an organization rather than individual users.

http://en.wikipedia.org/wiki/Enterprise_software

6

Definition #2 Display, manipulation, and storage of large amounts of often complex data. Support or automation of business processes with that data.

Martin Fowler

7

Attributes

Reliability

Productivity

Scalability

Security

8

First idea

9

What about PHP?

10

PHP

11

Definition Server-side scripting language, designed for web development. Also used as a general-purpose programming language.

http://en.wikipedia.org/wiki/PHP

12

Evolution1995

• Personal needs

2003• Simple websites• Content management• Blogs

2015• Big websites• Banks• Social networks• Online accounting• Insurance

13

PHP todayOpen source

Community

Backing

Ecosystem & tools

Security

Standards

14

Open source

https://github.com/php

15

Community

http://php.net/credits.php

16

Backing

17

Ecosystem & tools

18

Security

http://php.net/manual/en/book.password.php

https://security.sensiolabs.org

19

Standards

http://www.php-fig.org

20

Attributes

Flexibility

Easy integration

Quickness

Availability of personnel

21

But PHP is just a building material

22

Result depends on team and tools

23

Symfony 2

24

Definition PHP web application framework for MVC applications. Free software and released under the MIT license.

https://en.wikipedia.org/wiki/Symfony

25

Goals Speeding up the creation and maintenance of web applications and to replace repetitive coding tasks.

Building robust applications in an enterprise context.

Giving developers full control over the configuration.

https://en.wikipedia.org/wiki/Symfony

26

Enterprise attributes

Reliability

Productivity

Scalability

Security

27

And some other advantagesBacking

Maintenance and support

Community

Standards

Completed solutions

28

So big guys choose symfony

29

Example of project structure & workflow

30

Priority order

Environment Build Continuous integration Deployment

31

Environment

32

Main technologies•Sta

ndard de-facto

•High perfomance

Nginx•Bec

ause nginx

PHP-fpm

•Based on requirements

•Percona linux-only

MySQL/Percona/MariaDB

33

Other possible technologies

Git Composer RabbitMQ

ElsaticSearch/Sphinx Memcache/Redis Varnish

MongoDB Node.js

34

Servers

Dev

QA

Production

35

Orchestration

Ansible Puppet Chef

Custom

36

Build

37

Tools

Written in PHP

Extendable via PHP

Platform-independent

No external dependencies

Ant config syntax

38

Main build targets?Local build

before commit CI build

Package Deploy

39

Local & CI build tasksComposer-specific

• install

General• Validate code• Following standards• Unit tests• Create documentation

Symfony specific• Cache• Assets• Migrations• Fixtures

40

Package tasks

Create artifcats• tar.gz archive• Platform package (apt, yum)• Custom

Database scheme

41

Deploy tasksEnable/disable maintenance mode

Deploy artifacts

Download previous metadata

Clean previous releases

Rollback

42

Continuous integration

43

Tools

Free

Open source

Enterprise

Lot of plugins

44

Deployment

45

ToolsSymfony specific

Based on Capistrano

Open source

Multistage

Maintenance mode

46

Workflow (1/2)Enable maintenance mode

Download database backup

Deploy artifcats

Restart services

Symfony specific tasks

47

Workflow (2/2)

Disable maintenance mode

Clean old releases

48

Ways of interactionUser

Jenkins

Phing

Capifony

49

Questions?