Slide 1

Slide 1 text

High-Speed Modern Web Apps with PHP & AMF Danny Kopping #PHPJoburg14

Slide 2

Slide 2 text

• Mid-twenties • Senior PHP Developer @ Zando.co.za • Born ‘n’ raised in Joburg • Resident of Cape Town Bio

Slide 3

Slide 3 text

The Lay of the Land

Slide 4

Slide 4 text

Model → Data Layer View → Presentation Layer Controller → Logic Layer MVC

Slide 5

Slide 5 text

Model → Data Layer View → Presentation Layer Controller → Logic Layer MVC

Slide 6

Slide 6 text

A brief, mostly wrong (& somewhat offensive) history of Web development

Slide 7

Slide 7 text

1989 Sir Tim Berners-Lee has difficulty finding porn. Oh, and some academic shit.

Slide 8

Slide 8 text

1989 Like Facebook, the web was born in a university. ...and spread to other universities.

Slide 9

Slide 9 text

1991 The first HTTP spec is written. It’s one page long. You can use GET.

Slide 10

Slide 10 text

1993 The first Web browsers start to take shape.

Slide 11

Slide 11 text

1994 Python, PHP, Ruby & Perl are all dra#ed/created/released Not a swastika

Slide 12

Slide 12 text

1994 SSL is developed

Slide 13

Slide 13 text

1995 IE 1.0 is released.

Slide 14

Slide 14 text

1995 Oh, and Opera is released too. Its userbase has not grown much since.

Slide 15

Slide 15 text

1995 HTML 3.0 is released. CSS 0.92 is released.

Slide 16

Slide 16 text

1995 JavaScript is created by Brendan Eich. In 10 days. It sometimes shows. This is how much I hate gay marriage

Slide 17

Slide 17 text

1995 Java Applets are introduced. SmartSketch FutureSplash Flash is created. The dawn of Rich Internet Applications is born.

Slide 18

Slide 18 text

1995 Apache is released

Slide 19

Slide 19 text

1996 HTTP 1.0 is released. The spec has now grown to 70 pages. Woohoo, POST!

Slide 20

Slide 20 text

1996 XML 1.0 is defined.

Slide 21

Slide 21 text

1998 SOAP is designed and released. POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: 299 SOAPAction: "http://www.w3.org/2003/05/soap-envelope" IBM

Slide 22

Slide 22 text

1999 HTTP 1.1 is released. The spec has now grown to 176 pages. PUT, DELETE now available.

Slide 23

Slide 23 text

2001 JSON is invented by good ol’ Douglas Crockford

Slide 24

Slide 24 text

2002 Mozilla Firefox hits 1.0

Slide 25

Slide 25 text

2005 JSON explosion AJAX makes its way onto the scene

Slide 26

Slide 26 text

A DECADE PASSES...

Slide 27

Slide 27 text

2014 Ooh, it’s now responsive...

Slide 28

Slide 28 text

and the data?

Slide 29

Slide 29 text

Pretty much stuck in the early 2000s.

Slide 30

Slide 30 text

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

(not to scale)

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

LOL.

Slide 35

Slide 35 text

Slide 36

Slide 36 text

I used to code in Flash. The Dirty Little Secret ...and I miss it.

Slide 37

Slide 37 text

Yup. I said it.

Slide 38

Slide 38 text

What made Flash wonderful?

Slide 39

Slide 39 text

• Consistent UI across all browsers • Great scripting language (ActionScript 3.0) • Based on ECMAScript 262 (JavaScript) • AMF

Slide 40

Slide 40 text

Another Motherfucking Format

Slide 41

Slide 41 text

Action Message Format Created by Adobe

Slide 42

Slide 42 text

What is AMF?

Slide 43

Slide 43 text

What is AMF?

Slide 44

Slide 44 text

• Binary data serialization protocol What is AMF?

Slide 45

Slide 45 text

• Binary data serialization protocol • Originally used in Flash 6 / ActionScript 2.0 What is AMF?

Slide 46

Slide 46 text

• Binary data serialization protocol • Originally used in Flash 6 / ActionScript 2.0 • Two major versions: AMF0 & AMF3 What is AMF?

Slide 47

Slide 47 text

• Binary data serialization protocol • Originally used in Flash 6 / ActionScript 2.0 • Two major versions: AMF0 & AMF3 • Support for 18 distinct data types What is AMF?

Slide 48

Slide 48 text

• Binary data serialization protocol • Originally used in Flash 6 / ActionScript 2.0 • Two major versions: AMF0 & AMF3 • Support for 18 distinct data types • Many libraries available across several languages and platforms What is AMF?

Slide 49

Slide 49 text

• Binary data serialization protocol • Originally used in Flash 6 / ActionScript 2.0 • Two major versions: AMF0 & AMF3 • Support for 18 distinct data types • Many libraries available across several languages and platforms • Compression, data efficiency (references) What is AMF?

Slide 50

Slide 50 text

• Binary data serialization protocol • Originally used in Flash 6 / ActionScript 2.0 • Two major versions: AMF0 & AMF3 • Support for 18 distinct data types • Many libraries available across several languages and platforms • Compression, data efficiency (references) • Reconstruct object state across tiers What is AMF?

Slide 51

Slide 51 text

• Binary data serialization protocol • Originally used in Flash 6 / ActionScript 2.0 • Two major versions: AMF0 & AMF3 • Support for 18 distinct data types • Many libraries available across several languages and platforms • Compression, data efficiency (references) • Reconstruct object state across tiers • Can be GZIPed What is AMF?

Slide 52

Slide 52 text

Introducing... http://github.com/infomaniac-amf Infomaniac-AMF

Slide 53

Slide 53 text

• Infomaniac-AMF supports 10 data types Introducing... http://github.com/infomaniac-amf Infomaniac-AMF

Slide 54

Slide 54 text

• Infomaniac-AMF supports 10 data types • JS & PHP libs available Introducing... http://github.com/infomaniac-amf Infomaniac-AMF

Slide 55

Slide 55 text

• Infomaniac-AMF supports 10 data types • JS & PHP libs available • Fast-ish Introducing... http://github.com/infomaniac-amf Infomaniac-AMF

Slide 56

Slide 56 text

• Infomaniac-AMF supports 10 data types • JS & PHP libs available • Fast-ish • Unit-tested Introducing... http://github.com/infomaniac-amf Infomaniac-AMF

Slide 57

Slide 57 text

• Infomaniac-AMF supports 10 data types • JS & PHP libs available • Fast-ish • Unit-tested • Lightweight Introducing... http://github.com/infomaniac-amf Infomaniac-AMF

Slide 58

Slide 58 text

• Infomaniac-AMF supports 10 data types • JS & PHP libs available • Fast-ish • Unit-tested • Lightweight • Aims to be a drop-in replacement for JSON Introducing... http://github.com/infomaniac-amf Infomaniac-AMF

Slide 59

Slide 59 text

• Infomaniac-AMF supports 10 data types • JS & PHP libs available • Fast-ish • Unit-tested • Lightweight • Aims to be a drop-in replacement for JSON • AMF.stringify(obj, options) Introducing... http://github.com/infomaniac-amf Infomaniac-AMF

Slide 60

Slide 60 text

• Infomaniac-AMF supports 10 data types • JS & PHP libs available • Fast-ish • Unit-tested • Lightweight • Aims to be a drop-in replacement for JSON • AMF.stringify(obj, options) • AMF.parse(amfData) Introducing... http://github.com/infomaniac-amf Infomaniac-AMF

Slide 61

Slide 61 text

Data types http://github.com/infomaniac-amf Infomaniac-AMF UNDEFINED NULL BOOLEAN INT DOUBLE STRING ARRAY OBJECT BYTE-ARRAY DATE

Slide 62

Slide 62 text

AMF is the future. ...or what the future could be like.

Slide 63

Slide 63 text

Should JSON/XML die? No. Is AMF better than x? Not necessarily.

Slide 64

Slide 64 text

Oh demo gods... Grant me luck!

Slide 65

Slide 65 text

CODE DEMO