News Feed

News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Thomas Weinert:
Basics Using Arduino From PHP
June 21, 2013 @ 09:33:52

In his latest post Thomas Weinert talks about using an Ardiuno board from inside of PHP (most people seem to use Python instead).

This is the version mostly described on the net. For example on Instructables. Basically you write an Arduino Scetch that listens and send plain text data on the serial port. A PHP Script triggered by a webserver request opens the port communicates with the Arduino board an outputs some HTML. The major downside of this approach is that many Arduino boards reset if the serial port is opened. So the startup and configuration has to be done any time the PHP scripts reads some data or triggers an action.

He talks about the Firmata software and an alternative to trying to call it through PHP - using one of a few non-blocking I/O libraries like React PHP. He's created his own non-blocking library that's made to work more specifically with the Firmata protocol, though. Some code samples are provided showing how to use it to make a light blink ("Hello world" for Arduino) and working with the data from a dimmer.

0 comments voice your opinion now!
arduino library nonblocking caricaio firmata tutorial


Brandon Savage:
Consuming RabbitMQ messages with PHP
May 31, 2013 @ 09:15:47

Brandon Savage continues his look at using RabbitMQ and PHP together to queue up requests today in this latest post. In this new part of the series, he focuses on the last piece of the puzzle - consuming the requests in the queue. (Parts one and two)

Once you've created a RabbitMQ producer, it's fairly easy to create a consumer. In fact, the only difference is in exactly what commands you're using. The connection, envelope, channel and queue declarations are the same. While in RabbitMQ you publish to the exchange, you actually do consume a specific queue. As a result, the commands for consuming are part of the AMQPQueue class.

He shows you how to set up the code to sit in the background and wait for a queue request and how to fetch them in a non-blocking way. He finishes off the post with a look at handling success and error conditions (based on the status of message consumption, not the result of the processing).

0 comments voice your opinion now!
rabbitmq tutorial consume amqp library success failure nonblocking background


Rob Young's Blog:
Non-blocking I/O With PHP-MIO
April 24, 2007 @ 10:54:00

Via the Zend Developer Zone, I found out about this new article from Rob Young about using PHP-MIO to create non-blocking I/O.

A couple of weeks ago I was thinking about non-blocking I/O in PHP, specifically about how clunky PHP's select implementation is. I say clunky because it's not bad, it's just not as easy to use as it could be.

[...] I have to remember which streams I'm interested in writing to, which streams I'm interested in reading from and when I get to accepting connections, which streams are server sockets that I'm interested in accepting connections on. I'm lazy, I don't want to have to do that , I want a library to handle all that for me. At this point I decided to implement something similar to Java's non-blocking I/O in PHP5. This is now finished and up on sourceforce (under the name of phpmio). In this article I hope to give you enough information to get up and running with the package.

He explains what multiplexed I/O is (including code), what PHP-MIO is (yes, including code), and a more real life example of how to use it - a simple server that accepts connections and spits back a simple response.

0 comments voice your opinion now!
phpmio nonblocking multiplexed Io tutorial phpmio nonblocking multiplexed Io tutorial

Community Events

Don't see your event here?
Let us know!

symfony podcast framework example opinion yii2 application project programming api language community part2 introduction laravel interview list php7 composer series

All content copyright, 2015 :: - Powered by the Solar PHP Framework