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

PHP and node.js Together

PHP and node.js Together

This goes over a bit of what node.js is, why you might want to use it, and how to use it with your PHP projects.

ctankersley

May 15, 2013

Transcript

21 slides
  1. ¡  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  
  2. ¡  Go  over  what  node.js  is   ¡  What  good

     is  node.js?   ¡  Different  ways  to  use  it  with  PHP   5/15/2013   php|tek  2013  
  3. 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  
  4. ¡  It’s  JavaScript   ¡  npm  is  pretty  awesome  

    ¡  It’s  fast   ¡  There’s  a  huge  community   5/15/2013   php|tek  2013  
  5. ¡  Background  tasks   ¡  Server-­‐side  scripts   ¡  API

     endpoints   ¡  Websites   5/15/2013   php|tek  2013  
  6. ¡  Push  something  into  a  redis  via  PHP,  and  

    have  node.js  listen  and  react   5/15/2013   php|tek  2013  
  7. ¡  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  
  8. ¡  Same  idea,  but  the  work  sits  there  until  

    someone  deals  with  it   5/15/2013   php|tek  2013  
  9. ¡  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  

More Decks by ctankersley

Other Decks in Programming