![Page 1: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/1.jpg)
PHP is the king,
nodejs is the prince, Lua is the fool
@cirpo
![Page 2: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/2.jpg)
![Page 3: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/3.jpg)
![Page 4: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/4.jpg)
dubai
![Page 5: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/5.jpg)
dubai
![Page 6: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/6.jpg)
namshi
![Page 7: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/7.jpg)
namshi
![Page 8: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/8.jpg)
Namshi
almost 3 years old
~200 ppl
IT team ~15 ppl
million+ visits per month
serving the UAE and GCC
![Page 9: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/9.jpg)
![Page 10: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/10.jpg)
![Page 11: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/11.jpg)
![Page 12: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/12.jpg)
![Page 13: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/13.jpg)
![Page 14: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/14.jpg)
![Page 15: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/15.jpg)
PHP
![Page 16: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/16.jpg)
architecture
![Page 17: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/17.jpg)
a monolithic architecture
![Page 18: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/18.jpg)
so far so good… but we started growing…
![Page 19: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/19.jpg)
“we need a brand new feature for the warehouse…”
![Page 20: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/20.jpg)
SOA
![Page 21: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/21.jpg)
Service Oriented Architecture
![Page 22: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/22.jpg)
– A.Nadalin (@_odino)
“A software design based on discrete software components, "services", that collectively
provide the functionalities of the larger software application”
![Page 23: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/23.jpg)
– M.Fowler
“Microservice Architecture" […] a particular way of designing software applications as suites of
independently deployable services…” !
Full Stack is dead!
![Page 24: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/24.jpg)
services as Lego bricks
![Page 25: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/25.jpg)
Unix philosophy
“Write programs that do one thing and do it well.”
![Page 26: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/26.jpg)
SOA benefits
scalability avoid single point of failure easier and faster deploys isolation maintainability easier to replace existing parts
![Page 27: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/27.jpg)
How do you connect services?
![Page 28: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/28.jpg)
HTTP
A protocol that is almost 25 years old and is here to stay!
![Page 29: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/29.jpg)
GET vs POST“The difference is that in
a GET request you have the parameters in the url ,
with
a POST the parameters are in the request’s body” !
answered by 80% of candidates during the interview
![Page 30: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/30.jpg)
![Page 31: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/31.jpg)
“you don’t know HTTP? you shall not pass” !
!
- Gandalf
![Page 32: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/32.jpg)
RabbitMQ
![Page 33: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/33.jpg)
using crons!
![Page 34: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/34.jpg)
RabbitMQ
publish consume
q u e u e
![Page 36: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/36.jpg)
RabbitMQ
![Page 37: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/37.jpg)
RabbitMQ
Language and protocol format agnostic You can easily create an event driven architecture Messages stay in the queue if a service goes down Too many messages? add more consumers!
![Page 38: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/38.jpg)
PHP
![Page 39: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/39.jpg)
PHP - It follows standards (PSR-*)
Decoupled components
Huge and active opensource community
Easy to plug in your domain code
Not just a framework, but a project…
Designed starting from the HTTP protocol
![Page 40: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/40.jpg)
PHP -
bundle -> app -> service
![Page 41: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/41.jpg)
PHP -
UserBundle
WarehouseBundle
CheckoutBundle
ProductBundle
[…]
![Page 42: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/42.jpg)
Once you have a SOLID set of api foundation you can easily start building other awesome applications
![Page 43: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/43.jpg)
PHP - Silex
the PHP micro-framework based on Symfony2 Components
![Page 44: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/44.jpg)
PHP - Silex
![Page 45: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/45.jpg)
Let’s eat those apis!
![Page 46: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/46.jpg)
Javascript
![Page 47: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/47.jpg)
JavascriptTwo way data-binding
Single page application Built-in services on top of XHR
Routing Controller
Model it’s a MVW framework: Model-View-Whatever
![Page 48: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/48.jpg)
Javascript
![Page 49: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/49.jpg)
Javascript
![Page 50: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/50.jpg)
Javascript
![Page 51: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/51.jpg)
Javascript
![Page 52: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/52.jpg)
party time!
![Page 53: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/53.jpg)
from stateful to stateless
Removed server sessions Sessions on the client (localstorage)
![Page 54: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/54.jpg)
Stateless
JSON Web Signaturehttp://tools.ietf.org/html/draft-jones-json-web-signature-04
![Page 55: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/55.jpg)
PHP - JWS
github.com/namshi/jose
JOSÉ
![Page 56: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/56.jpg)
PHP - JWS
![Page 57: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/57.jpg)
PHP - JWS
![Page 58: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/58.jpg)
double party time!
![Page 59: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/59.jpg)
let’s do the same with the desktop website!
![Page 60: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/60.jpg)
some customers were experiencing some issues…
![Page 61: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/61.jpg)
javascript
![Page 62: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/62.jpg)
javascript -
![Page 63: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/63.jpg)
javascript -
![Page 64: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/64.jpg)
we rebuilt the desktop website in two weeks!
![Page 65: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/65.jpg)
javascript -
Rapid application development Quick setup Event driven Javascript!
why node?
![Page 66: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/66.jpg)
javascript -
github.com/namshi/mockserver
mockserver mock your APIs in a matter of seconds!
![Page 67: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/67.jpg)
javascript -
mockserver
![Page 68: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/68.jpg)
javascript - users_GET.mock file
mockserver
![Page 69: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/69.jpg)
javascript -
mockserver
![Page 71: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/71.jpg)
Javascript -
shisha
.smoke file
![Page 72: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/72.jpg)
Javascript -
shisha
![Page 73: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/73.jpg)
redis
![Page 74: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/74.jpg)
redis
Key types: lists, hashes, sets, sorted sets Persistent to disk
Up to 512MB per key Pub/sub
Transactions with optimistic locking Lua scripting embedded
![Page 75: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/75.jpg)
redis
github.com/nrk/predis
![Page 76: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/76.jpg)
lua
![Page 77: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/77.jpg)
lua
![Page 78: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/78.jpg)
actual architecture
other clients
![Page 79: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/79.jpg)
what’s next?
![Page 80: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/80.jpg)
what’s next?
![Page 81: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/81.jpg)
what’s next?
![Page 82: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/82.jpg)
we love php because
![Page 83: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/83.jpg)
il mondo è bello perché è vario
![Page 84: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/84.jpg)
open your mind…
![Page 85: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/85.jpg)
use the right tool
![Page 86: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/86.jpg)
you can solve problems in different ways
![Page 87: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/87.jpg)
@cirpo
github.com/cirpo
http://joind.in/talk/view/11477
/
![Page 88: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/88.jpg)
thanks
![Page 89: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/89.jpg)
tech.namsi.com/join-us
tech.namshi.com
github.com/namshi
@TechNamshi we are hiring!
![Page 90: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/90.jpg)
tech.namsi.com/join-us
tech.namshi.com
github.com/namshi
@TechNamshi we are hiring!
![Page 91: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/91.jpg)
thanks
![Page 92: PHP is the King, nodejs is the Prince and Lua is the fool](https://reader031.vdocuments.us/reader031/viewer/2022013003/54706ad4af7959f5458b4591/html5/thumbnails/92.jpg)
https://farm3.staticflickr.com/2199/2365883747_3a5c753719_o.jpg https://www.flickr.com/photos/karen_roe/8912245799
https://www.flickr.com/photos/anaxila/367953499/sizes/l https://www.flickr.com/photos/onigiri_chang/5356325784/sizes/o/
http://www.slideshare.net/odino/soa-with-symfony2-confoo-2014-in-montreal-ca https://www.flickr.com/photos/ejpphoto/2314610838/sizes/o/
https://www.flickr.com/photos/cesarastudillo/3981364314/sizes/l https://www.flickr.com/photos/piers_nye/2501994750/sizes/o/
https://www.flickr.com/photos/36247316@N00/3108399560/sizes/o/ https://www.flickr.com/photos/ironpoison_photos_69/9604127837/sizes/k/
!https://www.flickr.com/photos/chrisschoenbohm/5104367911/sizes/l
credits