<?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, 22 May 2013 13:16:34 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Chris Jones: Offline Processing in PHP with Advanced Queuing]]></title>
      <guid>http://www.phpdeveloper.org/news/19598</guid>
      <link>http://www.phpdeveloper.org/news/19598</link>
      <description><![CDATA[<p>
<i>Chris Jones</i> has a new post today showing you how to use Oracle and PHP together to <a href="https://blogs.oracle.com/opal/entry/offline_processing_in_php_with">process data offline</a> via the Oracle Streams Advanced Queuing feature.
</p>
<blockquote>
Offloading slow batch tasks to an external process is a common method of improving website responsiveness. One great way to initiate such background tasks in PHP is to use Oracle Streams Advanced Queuing in a producer-consumer message passing fashion. [...] The following example simulates an application user registration system where the PHP application queues each new user's street address. An external system monitoring the queue can then fetch and process that address. In real life the external system might initiate a snail-mail welcome letter, or do further, slower automated validation on the address.
</blockquote>
<p>
He includes the SQL needed to create the database and configure the queue system as well as start it up and get it ready for requests. He shows how to push an address into the queue for processing and how to get the results once it has completed in both the SQL and from the oci_* functions in PHP.
</p>
Link: https://blogs.oracle.com/opal/entry/offline_processing_in_php_with]]></description>
      <pubDate>Fri, 17 May 2013 09:49:26 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Segment.io: How to Make Async Requests in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/19142</guid>
      <link>http://www.phpdeveloper.org/news/19142</link>
      <description><![CDATA[<p>
On the Segment.io blog there's a new post by <i>Calvin</i> talking about <a href="https://segment.io/blog/how-to-make-async-requests-in-php/">making asyncronous requests in PHP</a> and three different approaches you could use, depending on your situation.
</p>
<blockquote>
When designing client libraries to send data to our API, one of our top priorities is to make sure that none of our code affects the performance of your core application. That is tricky when you have a single-threaded, "shared-nothing" language like PHP. [...] Ideally, we like to keep the setup process minimal and address a wide variety of use cases. As long as it runs with PHP (and possibly a common script or two), you should be ready to dive right in. We ended up experimenting with three main approaches to make requests in PHP. Here's what we learned.
</blockquote>
<p>
Their three suggestions don't involve external dependencies (like a queue server) and can operate pretty quickly:
</p>
<ul>
<li>Opening a socket and closing it before waiting for a response
<li>Write to a log file (a pseudo-queue)
<li>Fork a curl process (through something like <a href="http://php.net/exec">exec</a>)
</ul>
<p>
They each have small code examples included with them and explanations as to their plusses and minuses. For their needs, the "forked curl" solution worked out the best, but check out the other options too - you might have different needs.
</p>]]></description>
      <pubDate>Wed, 06 Feb 2013 09:52:49 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Wan Qi Chen: Background jobs with php and resque (Series)]]></title>
      <guid>http://www.phpdeveloper.org/news/18581</guid>
      <link>http://www.phpdeveloper.org/news/18581</link>
      <description><![CDATA[<p>
<i>Wan Qi Chen</i> has started a new series that looks at using PHP port of the <a href="https://github.com/defunkt/resque">resque</a> (a Ruby based tool) to do background processing for parts of his PHP applications - <a href="https://github.com/chrisboulton/php-resque">PHP-Resque</a>. So far, there's three parts to the series (with one more on the way):
</p>
<ul>
<li><a href="http://www.kamisama.me/2012/10/09/background-jobs-with-php-and-resque-part-1-introduction/">Part one</a> introduces the idea behind working with a background queue, the general workflow a process would follow and some of the benefits/drawbacks of using them.
<lI>In <a href="http://www.kamisama.me/2012/10/09/background-jobs-with-php-and-resque-part-2-queue-system/">part two</a> he gets more into the actual queue system and discusses the concept of a "job".
<li>The <a href="http://www.kamisama.me/2012/10/09/background-jobs-with-php-and-resque-part-3-installation/">third part</a> gets more into the implementation and helps you get the <a href="https://github.com/chrisboulton/php-resque">PHP-Resque</a>, <a href="https://github.com/nicolasff/phpredis">predis extension</a> and the <a href="http://www.php.net/manual/en/book.pcntl.php">process control extension</a> installed.
</ul>
<p>
The fourth part of the series (pending) will get into the actual code to implement this system you've job installed.
</p>]]></description>
      <pubDate>Wed, 10 Oct 2012 10:13:11 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Message Brokering with RabbitMQ]]></title>
      <guid>http://www.phpdeveloper.org/news/18385</guid>
      <link>http://www.phpdeveloper.org/news/18385</link>
      <description><![CDATA[<p>
On PHPMaster.com today they've posted a new tutorial that helps you get started adding queuing to your application <a href="http://phpmaster.com/message-brokering-with-rabbitmq/">with PHP and RabbitMQ</a>.
</p>
<blockquote>
RabbitMQ is open-source message brokering software written in Erlang. The MQ in its name refers to a standard known as Advanced Message Queuing Protocol.  For our purposes, and most others, it acts as a middleman between producer (sending) and consumer (receiving) programs - it simply accepts and forwards messages. [...] Both producers and consumers can be written in any language that has an available RabbitMQ or AMQP client library. In this article, I'll demo a producer program written in PHP and a consuming program in Python.
</blockquote>
<p>
He walks you through the installation for both <a href="http://www.rabbitmq.com/download.html">RabbitMQ</a> itself and the PHP (<a href="https://github.com/videlalvaro/php-amqplib">php-amqlib</a>) and Python (pika) tools to use for the interfaces. There's some details on how the queuing system works and the code for the sample clients is included as well as commands to use the two clients to send/receive messages.
</p>]]></description>
      <pubDate>Tue, 21 Aug 2012 11:04:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed.com: PHP: Best Methods for Running Scheduled Jobs]]></title>
      <guid>http://www.phpdeveloper.org/news/18152</guid>
      <link>http://www.phpdeveloper.org/news/18152</link>
      <description><![CDATA[<p>
On DevShed.com today there's a new article posted looking at <a href="http://www.devshed.com/c/a/PHP/PHP-Best-Methods-for-Running-Scheduled-Jobs-20103/">methods for running scheduled jobs</a> based on responses to <a href="http://forums.devshed.com/php-development-5/what-is-the-best-method-for-running-scheduled-jobs-in-916361.html">this forum post</a>.
</p>
<blockquote>
I have a webpage form that requires a date and time to be submitted. When it's submitted I need the back-end to run a script at the time and date specified. Have you ever needed to do something like this? 
</blockquote>
<p>Some recommendations already posted include:</p>
<ul>
<li>The UNIX <a href="http://en.wikipedia.org/wiki/At_(Unix)">"at" command</a>
<li>Setting up a queue system to manage the processes (using something similar to <a href="http://gearman.org/">Gearman</a>
<li>Setting up a <a href="http://en.wikipedia.org/wiki/Cron">cron job</a> to handle the periodic execution of the script.
<li>
</ul>]]></description>
      <pubDate>Thu, 28 Jun 2012 11:01:49 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Artur Ejsmont's Blog: Publishing queue messages from PHP using different backends]]></title>
      <guid>http://www.phpdeveloper.org/news/17729</guid>
      <link>http://www.phpdeveloper.org/news/17729</link>
      <description><![CDATA[<p>
<i>Artur Ejsmont</i> has <a href="http://artur.ejsmont.org/blog/content/publishing-messages-from-php-to-different-message-queue-backends">a new post</a> sharing some benchmarks he put together about the "messages per second" and "time to execute" when using PHP to pull from various messaging backends.
</p>
<blockquote>
I have looked at the state of different messaging backends recently and i ran a little benchmark to see what is the rough comparison of message publishing throughput. Results that i got are quite surprising. What i wanted to achieve is some sort of reassurance before choosing a messaging bus for my PHP project. 
</blockquote>
<p>
Running both the PHP and the messaging test scripts on the same server, he pulled from a few different backend systems - RabbitMQ, MySQL, MongoDb, Memcached and ActiveMQ. The results were interesting, showing an interesting result in the time it took to execute versus the number of messages per second pushed in. 
</p>]]></description>
      <pubDate>Mon, 26 Mar 2012 11:31:53 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Mfana Ronald Conco's Blog: RabbitMQ and PHP Part 2 - Durable Queues and Persistent Messages]]></title>
      <guid>http://www.phpdeveloper.org/news/17717</guid>
      <link>http://www.phpdeveloper.org/news/17717</link>
      <description><![CDATA[<p>
<i>Mfana Ronald Conco</i> has posted the second part of his RabbitMQ and PHP series to his blog today. This time he looks at <a href="http://www.theprogrammer.co.za/2012/03/19/rabbitmq-and-php-part-2-durable-queues-and-persistent-messages/">durable queues and persistent messages</a>
</p>
<blockquote>
You now have a queuing system that works and generates pdfs which are sent to users as per <a href="http://www.theprogrammer.co.za/2012/03/14/rabbitmq-and-php-part-1/">RabbitMQ and PHP Part 1</a> of this article. A week later after launching the queuing system you get one or two queries from users who claim to have made a request to get the pdf report but it never arrived. Okay, what could have happened ? well you go through the application log files and as suspected  - An Exception was thrown by one your classes as the consumer was trying to create the pdf and that is why it was never sent. Now this compromises the queuing system Totally, But wait there is a way to help prevent such.
</blockquote>
<p>
He shows how to make your queues "durable", meaning they'll survive a broker restart and they require a response from the consumer before being removed. He shows how (via the <a href="http://www.php.net/manual/en/book.amqp.php">php-ampq</a> functionality) to add the "AMPQ_DURABLE" flag to the queue definition. He also includes some code showing how to send back the acknowledgement so the entry can be removed from the queue. He also includes an update to the code that calls "publish" to make the messages persistent too.
</p>]]></description>
      <pubDate>Thu, 22 Mar 2012 13:39:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Zend Job Queue]]></title>
      <guid>http://www.phpdeveloper.org/news/17388</guid>
      <link>http://www.phpdeveloper.org/news/17388</link>
      <description><![CDATA[<p>
In <a href="http://phpmaster.com/zend-queue/">this most recent post</a> to PHPMaster.com <i>Alex Stetsenko</i> takes a look at the Zend Job Queue functionality, a part of the <a href="http://www.zend.com/products/server/">Zend Server</a> installation. He talks about some basic usage to make HTTP requests and a more extended example showing report generation.
</p>
<blockquote>
Web applications usually follow a synchronous communication model. However, non-interactive and long-running tasks (such as report generation) are better suited for asynchronous execution. One way to off-load tasks to run at a later time, or even on a different server, is use the Job Queue module available as a part of Zend Server 5 (though not as part of the Community Edition). Job Queue allows job scheduling based on time, priority, and even dependencies
</blockquote>
<p>
In his two examples, he shows the code involved to create a new Queue object and define a HttpJob in it. The first just calls a "sample.php" script that's exposed as a part of your external-facing site and shows how you can get the current status of the job. The more advanced example shows a call to a "report.php" script with a set of options defining things like "type", "length" and "priority". He also points out some other options that can do similar things like <a href="http://gearman.org/">Gearman</a>, <a href="http://nodejs.org/">NodeJs</a> and <a href="http://www.rabbitmq.com/">RabbitMQ</a>.
</p>]]></description>
      <pubDate>Fri, 13 Jan 2012 08:37:31 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Justin Carmony's Blog: PHP Workers with Redis & Solo]]></title>
      <guid>http://www.phpdeveloper.org/news/17378</guid>
      <link>http://www.phpdeveloper.org/news/17378</link>
      <description><![CDATA[<p>
In <a href="http://www.justincarmony.com/blog/2012/01/10/php-workers-with-redis-solo/">this latest post</a> to his blog <i>Justin Carmony</i> shares some of his experience using Redis and <a href="http://timkay.com/solo/solo">Solo</a> to asynchronously run queries and return data without the user having to wait. 
</p>
<blockquote>
Sometimes there are situations when you want to parallel process things. Other times you might have a list of tasks to accomplish, and you don't want to make the user wait after pressing a button. This is where "Workers" can come in. They are independent scripts that run along side of your application, performing tasks, or "jobs."
</blockquote>
<p>
Solo is a very basic Perl script that ensures only one process of a type is running at once. Using this and a PHP library called <a href="https://github.com/nrk/predis">predis</a>, he shows how to set up workers and add items to your processing queue. The workers themselves run on a cron job and connect to the queue server to see what they need to do. He also throws in some "bells and whistles" - extras that can enhance your worker system: queue monitoring, version numbering and killing workers based on a hash value.
</p>
<p>
His code examples are posted on <a href="https://github.com/JustinCarmony/PHP-Workers-with-Redis-Solo-Examples">his github account</a> and a screencast is <a href="http://www.justincarmony.com/blog/2012/01/10/php-workers-with-redis-solo/">included in the post</a> to show the system in action.
</p>]]></description>
      <pubDate>Wed, 11 Jan 2012 11:50:52 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Understanding the Command Design Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/17335</guid>
      <link>http://www.phpdeveloper.org/news/17335</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new article introducing you to the Command design pattern and looking to help you <a href="http://phpmaster.com/understanding-the-command-design-pattern">understand its use a bit better</a>.
</p>
<blockquote>
The majority of [cell phone] users have opted to receive an email, but a significant number are now opting to receive the notifications via SMS. Here's the problem: How do you send a message via two different channels to both groups of users? The logical approach would be to split the users into 2 groups, email recipients and SMS recipients, which would involve running 2 different queries and sending the codeword to each group separately. Using the Command Pattern, which I will introduce you to in this article, you can send the message to both groups of users in a single process.
</blockquote>
<p>
He uses the message queue he mentioned as an example - showing how you can can queue up different kinds of objects (actions) based on a common interface into the same process. He creates a "DailyAlertEmail" and "DailyAlertSMS" classes, both with a "send" method. The settings for these are then pulled from a database and the "execute" method on the "MessageQueue" class is called to loop through them, calling "send" to do that work.
</p>]]></description>
      <pubDate>Tue, 03 Jan 2012 08:25:29 -0600</pubDate>
    </item>
  </channel>
</rss>
