<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 23 May 2012 19:56:37 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Database connection pooling with PHP and React (node.php)]]></title>
      <guid>http://www.phpdeveloper.org/news/17983</guid>
      <link>http://www.phpdeveloper.org/news/17983</link>
      <description><![CDATA[<p>
In <a href="http://gonzalo123.wordpress.com/2012/05/21/database-connection-pooling-with-php-and-react-node-php/">this latest post</a> <i>Gonzalo Ayuso</i> his recent experiences with <1 href="http://nodephp.org/">React</a> (Node.js in PHP) and an example of how he worked up a script to pool database connections.
</p>
<blockquote>
Last saturday I meet a new hype: "<a href="http://nodephp.org/">React</a>" also known as "node.php". Basically it's the same idea than node.js but built with PHP instead of javascript. [...] Basically I want to create a database connection pooling. It's one of the things that I miss in PHP. I wrote a post here some time ago with this idea with one exotic experiment building one <a href="http://gonzalo123.wordpress.com/2010/11/01/database-connection-pooling-with-php-and-gearman/">connection pooling using gearman</a>. Today the idea is the same but now with React.
</blockquote>
<p>
He includes the sample script, also including the line to add to your composer.json file to install React and the SQL to create the sample tables. The script makes a PDO connection and assigns it to the pool, an instance of his "CPool" class. If you want to try it out, you can find the code <a href="https://github.com/gonzalo123/CPool">over on github</a>.
</p>]]></description>
      <pubDate>Mon, 21 May 2012 10:19:44 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: 5 ways how PHP is better than Node.js]]></title>
      <guid>http://www.phpdeveloper.org/news/17863</guid>
      <link>http://www.phpdeveloper.org/news/17863</link>
      <description><![CDATA[<p>
In what's sure to be a "flame bait" kind of post, <i>Jani Hartikainen</i> has posted <a href="http://codeutopia.net/blog/2012/04/24/5-ways-how-php-is-better-than-node-js/">five reasons PHP is better than Node.js</a> - some simple one-liners and others a bit more complicated.
</p>
<blockquote>
All hail Node.js! Boo PHP! Except there are various things where PHP is better than Node…
</blockquote>
<p>His five reasons are:</p>
<ul>
<li>Easier to find hosting
<li>It's easier to get started with PHP
<li>If your PHP code breaks, it doesn't bring your whole server down
<li>PHP processes are short lived
<li>Bigger standard library
</ul>
<p>
There's a few comments on the post already, one noting that some of the points could be turned around to make PHP fall more on the "bad" side.
</p>]]></description>
      <pubDate>Wed, 25 Apr 2012 09:13:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Anthony Wlodarski's Blog: Node.js and Zend Auth with Sessions stored in the database]]></title>
      <guid>http://www.phpdeveloper.org/news/17637</guid>
      <link>http://www.phpdeveloper.org/news/17637</link>
      <description><![CDATA[<p>
<i>Anthony Wlodarski</i> has <a href="http://anthonyw.net/2012/03/node-js-and-zend-auth-with-sessions-stored-in-the-database/">posted a quick example</a> of how he shared the sessions from <a href="http://framework.zend.com/manual/en/zend.auth.html">Zend_Auth</a> in his Zend Framework application over with a Node.js server/application.
</p>
<blockquote>
Recently on a project I had to make changes to a underlying portion of the sites architecture to move sessions in Zend Framework from file storage to database storage. However this affected a piece of the architecture. Node.js, which manages all our real time interaction, looked at sessions at the file level. This was quite a easy transition for the function as it was abstracted away in a function call so the theory was to just replace the function "guts" with a new component.
</blockquote>
<p>
The post shows the code he came from (which pulled in the PHP session file and extracted the session data manually) over to a new database-based version that selects from the SESSIONS table and pulls out the data. It's based on the table having an "id" column and the Zend_Auth namespace it uses.
</p>]]></description>
      <pubDate>Wed, 07 Mar 2012 09:50:46 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Francois Zaninotto's Blog: Node.js for PHP Programmers #1: Event-Driven Programming... and Pasta]]></title>
      <guid>http://www.phpdeveloper.org/news/17450</guid>
      <link>http://www.phpdeveloper.org/news/17450</link>
      <description><![CDATA[<p>
On his blog today <i>Francois Zaninotto</i> has a post that aims to <a href="http://dotheweb.posterous.com/nodejs-for-php-programmers-1-event-driven-pro">introduce those with a PHP background to how Node.js</a> works. In this first part of his series, he tries to explain the idea of event-driven programming - parallel processing of different parts of an application based on some action taken in the code.
</p>
<blockquote>
For a PHP developer, asynchronicity is the most puzzling aspect of the Node.js runtime. It's simply a new way to write programs. And once you pass the first learning steps, event-driven programming opens a world of possibilities PHP programmers would never dream of. I'll try to explain you how it works, but first, let's talk about pasta.
</blockquote>
<p>
In his "pasta" example, he shows how a typical PHP application would make a "Pan" object, call a "warm" action, "add olive oil", etc. All of this happens in sequence, though and takes 29 "minutes" to complete. To help things along, he implements an "EventLoop" class that handles tracking the timing and includes two methods to execute callbacks and delayed methods. He expands on this example with asynchronous objects and method calls to handle multiple things at once. He relates this to what Node.js offers - a built in event handling system, an included EventLoop object and native blocking I/O operations. 
</p>]]></description>
      <pubDate>Thu, 26 Jan 2012 08:35:41 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Henri Bergius' Blog: DNode: Make PHP And Node.Js Talk To Each Other]]></title>
      <guid>http://www.phpdeveloper.org/news/17060</guid>
      <link>http://www.phpdeveloper.org/news/17060</link>
      <description><![CDATA[<p>
<i>Henri Bergius</i> has a new post to his blog today sharing details about a messaging protocol that can help PHP and Node.js play together nicely - <a href="http://substack.net/posts/85e1bd/DNode-Asynchronous-Remote-Method-Invocation-for-Node-js-and-the-Browser">DNode</a>.
</p>
<blockquote>
Both environments have their strong points. Node.js is very fast and flexible, but PHP has a lot more mature tools and libraries available. So in a lot of projects it is hard to choose between the two. But now you might not have to. <a href="http://substack.net/posts/85e1bd/DNode-Asynchronous-Remote-Method-Invocation-for-Node-js-and-the-Browser">DNode</a> is a remote method invocation protocol originally written for Node.js, as the name probably tells. But as <a href="https://github.com/substack/dnode-protocol#readme">the protocol</a> itself is quite simple, just sending newline-terminated JSON packets over TCP connections, implementations have started popping up in other languages. You can talk DNode in <a href="https://github.com/substack/dnode-ruby">Ruby</a>, <a href="https://github.com/substack/dnode-perl">Perl</a>, <a href="https://github.com/jesusabdullah/dnode-python">Python</a>, <a href="https://github.com/aslakhellesoy/dnode-java">Java</a>, and now <a href="https://github.com/bergie/dnode-php">PHP</a>.
</blockquote>
<p>
He includes a <a href="http://bergie.iki.fi/blog/dnode-make_php_and_node-js_talk_to_each_other/">quick example</a> of both sides of the messaging - a simple server on the Node.js side that looks for a DNode request and using the <a href="https://github.com/bergie/dnode-php">dnode PHP client</a> to connect to it (and return the input number multiplied by 100). He also includes a method that allows for bidirectional communication with a service that converts from Celsius to Fahrenheit.
</p>]]></description>
      <pubDate>Mon, 31 Oct 2011 09:50:05 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Anthony Wlodarskis Blog: Authentication with Node.js and Zend Framework]]></title>
      <guid>http://www.phpdeveloper.org/news/16649</guid>
      <link>http://www.phpdeveloper.org/news/16649</link>
      <description><![CDATA[<p>
<i>Anthony Wlodarski</i> has put together a new post to his blog talking about <a href="http://anthonyw.net/2011/07/authentication-with-node-js-and-zend-framework/">authenticating a Zend Framework app against Node.js</a> with the help of the <a href="http://socket.io/">Socket.io</a> component for handling credentials.
</p>
<blockquote>
Zend Framework which is PHP based and Node.js which is JavaScript based don't have a common connection to pass data in a bi-directional nature. I was tasked with building a bridge of sorts that would utilize existing information from Zend Framework with the latest release of Socket.io's authorization mechanisms. (If you don't do this then arbitrary connections can happen and will be authorized.)
</blockquote>
<p>
He starts with the code (on the Node.js side) to create a simple HTTP server to listen for the requests from the Zend Framework application. He gets into the details of how that all works before moving to the other side - a simple update to the authentication to store a session cookie with the information that is passed, via Socket.io to the waiting Node.js server for handling.
</p>]]></description>
      <pubDate>Thu, 28 Jul 2011 13:41:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Using node.js to store PHP sessions]]></title>
      <guid>http://www.phpdeveloper.org/news/16627</guid>
      <link>http://www.phpdeveloper.org/news/16627</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has an <a href="http://gonzalo123.wordpress.com/2011/07/25/using-node-js-to-store-php-sessions/">interesting new post</a> today looking at how to go cross-technology in your application and store your PHP sessions in a basic Node.js instance.
</p>
<blockquote>
We use <a href="http://www.php.net/manual/en/book.session.php">sessions</a> when we want to preserve certain data across subsequent accesses. PHP allows us to use different handlers when we're using sessions. The default one is filesystem, but we can change it with <A href="http://www.php.net/manual/en/session.configuration.php#ini.session.save-handler">session.save_handler</a> in the php.ini. session.save_handler defines the name of the handler which is used for storing and retrieving data associated with a session. We also can create our own handler to manage sessions. In this post we're going to create a custom handler to store sessions in a node.js service.
</blockquote>
<p>
He includes the full code you'll need (also <a href="https://github.com/gonzalo123/nodePhpSessions">here</a> on github) to make a custom session handling class on the PHP side and some simple unit tests done on the Node.js side to ensure for proper handling and garbage collection.
</p>]]></description>
      <pubDate>Mon, 25 Jul 2011 11:43:45 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Real time monitoring PHP applications with websockets and node.js]]></title>
      <guid>http://www.phpdeveloper.org/news/16313</guid>
      <link>http://www.phpdeveloper.org/news/16313</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has a new post to his blog today looking at a method you can use for <a href="http://gonzalo123.wordpress.com/2011/05/09/real-time-monitoring-php-applications-with-websockets-and-node-js/">real-time monitoring of your PHP applications</a> with a combination of websockets and Node.js. The trick is to handle the PHP errors and send them over to a Node.js server for processing.
</p>
<blockquote>
The inspection of the error logs is a common way to detect errors and bugs. We also can show errors on-screen within our developement server, or we even can use great tools like firePHP to show our PHP errors and warnings inside our firebug console. That's cool, but we only can see our session errors/warnings. If we want to see another's errors we need to inspect the error log. tail -f is our friend, but we need to surf against all the warnings of all sessions to see our desired ones. Because of that I want to build a tool to monitor my PHP applications in real-time.
</blockquote>
<p>
The service will work similar to a chat server, sending messages one at a time to the remote server via a web client (HTML5-based) and some backend PHP. He includes all the code you'll need to create the HTTP and web socket server as well as the web client (with some Javascript) and some example server-side PHP. It throws an exception and catches it to send to the waiting Node.js server. A <a href="http://www.youtube.com/watch?v=KnBRcU_tBkk">screencast</a> is also included showing the full process. You can get the complete code for this example in <a href="https://github.com/gonzalo123/RealTimeMonitor">this repository</a> on <i>Gonzalo</i>'s github account.
</p>]]></description>
      <pubDate>Mon, 09 May 2011 11:02:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Morgan's Blog: Howto Log Directly to Your OS X Terminal using Zend Framework and NodeJS]]></title>
      <guid>http://www.phpdeveloper.org/news/14058</guid>
      <link>http://www.phpdeveloper.org/news/14058</link>
      <description><![CDATA[<p>
In an interesting post to his blog <i>Rob Morgan</i> shows how you can <a href="http://robmorgan.id.au/post/385010188/howto-log-directly-to-your-os-x-terminal-using-zend">log in to a terminal</a> from a Zend Framework application (on OS X) with the help of <a href="http://nodejs.org/">NodeJS</a>.
</p>
<blockquote>
<a href="http://nodejs.org/">NodeJS</a> is a tool designed to provide an easy way to build scalable network programs. By using the I/O capabilities of NodeJS, I have built a simple <a href="http://en.wikipedia.org/wiki/Transmission_Control_Protocol">TCP</a> server that writes log messages to the OS X terminal (via STDOUT). 
</blockquote>
<p>
He shows how to take <a href="http://github.com/robmorgan/node_log">his example script</a> and run NodeJS as a server on a local port (like 8003). You can then use <a href="http://github.com/robmorgan/zfnode_log_writer">his log writer plugin</a> in your Zend Framework app to write directly to the waiting NodeJS server.
</p>]]></description>
      <pubDate>Fri, 19 Feb 2010 11:14:02 -0600</pubDate>
    </item>
  </channel>
</rss>

