Upgrade to Pro — share decks privately, control downloads, hide ads and more …

High-Speed Modern Web Apps with PHP & AMF

High-Speed Modern Web Apps with PHP & AMF

JSON has become the lingua-franca between web developers and APIs, but it has some critical limitations that stunt some possibilities of modern web development.

In this somewhat esoteric talk, I will discuss the possibility of using AMF - a binary data-interchange protocol - in web applications, using PHP & JavaScript. AMF allows for a wider array of data type encodings, circular references, and more. AMF has been used with Flash applications for years, is tried and true - and, as I will hopefully convince you, should be used in modern web applications.

Dougie Crockford, you're on.

Danny Kopping

April 05, 2014
Tweet

More Decks by Danny Kopping

Other Decks in Programming

Transcript

  1. • Mid-twenties • Senior PHP Developer @ Zando.co.za • Born

    ‘n’ raised in Joburg • Resident of Cape Town Bio
  2. 1989 Like Facebook, the web was born in a university.

    ...and spread to other universities.
  3. 1995 JavaScript is created by Brendan Eich. In 10 days.

    It sometimes shows. This is how much I hate gay marriage
  4. 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" <!- -> <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Header> </soap:Header> <soap:Body> <m:GetStockPrice xmlns:m="http://www.example.org/stock"> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope>
  5. 1999 HTTP 1.1 is released. The spec has now grown

    to 176 pages. PUT, DELETE now available.
  6. • Consistent UI across all browsers • Great scripting language

    (ActionScript 3.0) • Based on ECMAScript 262 (JavaScript) • AMF
  7. • Binary data serialization protocol • Originally used in Flash

    6 / ActionScript 2.0 • Two major versions: AMF0 & AMF3 What is AMF?
  8. • 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?
  9. • 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?
  10. • 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?
  11. • 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?
  12. • 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?
  13. • Infomaniac-AMF supports 10 data types • JS & PHP

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

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

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

    libs available • Fast-ish • Unit-tested • Lightweight Introducing... http://github.com/infomaniac-amf Infomaniac-AMF
  17. • 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
  18. • 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
  19. • 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