Slide 1

Slide 1 text

5/15/2013   php|tek  2013   E-­‐mail:  [email protected]   Twitter:  @dragonmantank   App.net:  @ctankersley  

Slide 2

Slide 2 text

¡  Chris  Tankersley   ¡  Doing  PHP  for  9  Years   ¡  Lots  of  projects  no  one  uses,  and  a  few  that   some  do   §  TL;DR  https://github.com/dragonmantank   March  3rd,  2013   MidwestPHP   2  

Slide 3

Slide 3 text

¡  Go  over  what  node.js  is   ¡  What  good  is  node.js?   ¡  Different  ways  to  use  it  with  PHP   5/15/2013   php|tek  2013  

Slide 4

Slide 4 text

5/15/2013   php|tek  2013  

Slide 5

Slide 5 text

node.js  is  a  server-­‐side  implementation  of  the   Google  V8  JavaScript  engine     In  broad  terms,  it  does  the  same  job  as  PHP  but   with  JavaScript   5/15/2013   php|tek  2013  

Slide 6

Slide 6 text

5/15/2013   php|tek  2013  

Slide 7

Slide 7 text

¡  It’s  JavaScript   ¡  npm  is  pretty  awesome   ¡  It’s  fast   ¡  There’s  a  huge  community   5/15/2013   php|tek  2013  

Slide 8

Slide 8 text

¡  It’s  just  JavaScript,  nothing  fancy   5/15/2013   php|tek  2013  

Slide 9

Slide 9 text

5/15/2013   php|tek  2013  

Slide 10

Slide 10 text

¡  node.js   ¡  Silex   5/15/2013   php|tek  2013  

Slide 11

Slide 11 text

¡  Background  tasks   ¡  Server-­‐side  scripts   ¡  API  endpoints   ¡  Websites   5/15/2013   php|tek  2013  

Slide 12

Slide 12 text

5/15/2013   php|tek  2013  

Slide 13

Slide 13 text

¡  Call  node.js  just  like  any  other  program   5/15/2013   php|tek  2013  

Slide 14

Slide 14 text

5/15/2013   php|tek  2013  

Slide 15

Slide 15 text

¡  Push  something  into  a  redis  via  PHP,  and   have  node.js  listen  and  react   5/15/2013   php|tek  2013  

Slide 16

Slide 16 text

¡  PHP  and  node.js  connect  to  a  redis  channel   ¡  PHP  publish  something  to  the  channel   ¡  node.js  gets  the  message  and  reacts   ¡  Really  good  for  reacting  to  events,  but   requires  node.js  to  be  listening   5/15/2013   php|tek  2013  

Slide 17

Slide 17 text

¡  Same  idea,  but  the  work  sits  there  until   someone  deals  with  it   5/15/2013   php|tek  2013  

Slide 18

Slide 18 text

¡  Allows  two-­‐way  communication  from  the   browser  to  the  server   ¡  Most  browsers  should  support  it   ¡  Use  socket.io  to  handle  old  browsers   5/15/2013   php|tek  2013  

Slide 19

Slide 19 text

5/15/2013   php|tek  2013  

Slide 20

Slide 20 text

5/15/2013   php|tek  2013  

Slide 21

Slide 21 text

5/15/2013   php|tek  2013   [email protected]   @dragonmantank     https://joind.in/8165