News Feed
Jobs Feed
Sections




News Archive
feed this:

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

Thomas Weinert:
Building A Sensor Phalanx With PHP
November 18, 2013 @ 09:15:12

Thomas Weinert continues his series looking at merging the physical and virtual using PHP to with messages coming from servers and how to build it into a sensor phalanx.

Sensors are fun. They report from the physical world into the digital. But getting the signal into php is only the first part, you will have to get them out again. This post shows how to get data from analog sensors pushed to the browser. It uses Carica Chip, if you haven't read my previous blog post you should do it first.

He talks about the use of ReactPHP in the Carica library and the addition of Ratchet to help with the websocket messaging. He sets up two simple servers - one HTTP, the other websocket - to handle the reporting and interaction with the sensor. He includes the code for the HTTP server and uses his example code to make the phalanx listening on 8081. Some other code is included to make the listeners and the simple UI for the charts. A video is included showing it all in action, reacting to a moving light.

0 comments voice your opinion now!
sensor phalanx tutorial carica chip library reactphp ratchet

Link: http://www.a-basketful-of-papayas.net/2013/11/building-sensor-phalanx-with-php.html

Phil Sturgeon:
Benchmarking Codswallop NodeJS v PHP
November 12, 2013 @ 09:21:29

Phil Sturgeonhas posted about some Node.js vs PHP benchmarks that someone linked him to concerning web scraping. The article suggests that Node.js "owns" PHP when it comes to this but, as Phil finds out, there's a bit more to the story than that.

Sometimes people link me to articles and ask for my opinions. This one was a real doozy. Oh goody, a framework versus language post. Let's try and chew through this probable linkbait [where] we're benchmarking NodeJS v PHP. Weird, but I'll go along with it. Well, now we're testing cheerio v PhpQuery which is a bit different, but fine, let's go along with it.

Through a little discovery, Phil noticed phpQuery using file_get_contents, a blocking method for fetching the remote pages to scrape. Node.js instead uses a non-blocking method, meaning multiple files can be fetched at the same time. In answer to this blocking vs non-blocking, he decided to run benchamrks against a few cases - Node.js/Cherrio, PHP/phpQuery and his own, more correct comparison to the Node option - PHP/ReactPHP/phpQuery. He's shared his results, showing a major difference between the straight phpQuery and the React-based version.

It seems likely to me that people just assume PHP can't do this stuff, because by default most people arse around PHP with things like MAMP, or on their shitty web-host where is is hard to install things and as such get used to writing PHP without utilizing many extensions. It is probably exactly this which makes people think PHP just can't do something, when it easily can.
0 comments voice your opinion now!
nodejs reactphp webpage scraping benchmark compare

Link: http://philsturgeon.co.uk/blog/2013/11/benchmarking-codswallop-nodejs-v-php


Community Events











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


hack facebook install symfony2 language release hhvm component composer framework database security series application unittest podcast performance package opinion introduction

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework