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

Gonzalo Ayuso:
How to run a Web Server from a PHP application
November 11, 2013 @ 11:53:06

Gonzalo Ayuso has put together a post showing how (by implementing the Reactor design pattern) he created a simple web server inside a PHP application. It combines a few Symfony2 components and the React library to build a simple server in a bit more programatic way.

Normally we deploy our PHP applications in a webserver (such as apache, nginx, ). I used to have one apache webserver in my personal computer to play with my applications, but from time to now I prefer to use PHP's built-in webserver for my experiments. It's really simple. [...] With PHP we cannot do it. Sure? That assertion isn't really true. We can do it. I've just create one small library to do it in two different ways. First running the built-in web server and also running one React web server.

The idea is that all that would be needed is a stand-alone PHP script that could be run anywhere and start up its own web server, no other software required. He includes a simplified version of the example, showing how to make servers with both React and PHP's own server. He also includes an example of a basic Silex application that uses it as well as some benchmarks (with Apache ab) for each of the implementations and their request/response times on average for simple and Silex requests.

0 comments voice your opinion now!
builtin webserver server example react silex

Link: http://gonzalo123.com/2013/11/11/how-to-run-a-web-server-from-a-php-application/

Stoyan Stefanov:
Server-side React with PHP - part 2
September 19, 2013 @ 09:35:38

In a a previous post Stoyan Stefanov introduced a setup where you could render React templates on the server-side with the help of PHP and the v8 parsing. In this second part of the series, he extends that system and shows how to use it to update views based on new data.

Part 1 ended with todos. The first one was to couple the server-side generated code with the client-side React, so that any updates past the initial page load will be handled by React's client JS, which is where React shines. Let's see how you can do just that.

He gives an example similar to his previous one - displaying a table - but shows how to inject some values from PHP as a JSON string into the component. This time he saves the output of that rendering into a variable and reuses it as a part of a whole site render later.

0 comments voice your opinion now!
react javascript js v8 serverside render tutorial data

Link: http://www.phpied.com/server-side-react-with-php-part-2/

Stoyan Stefanov:
Server-side React with PHP
September 16, 2013 @ 09:28:24

On phpied.com Stoyan Stefanov has a new post showing how to do server-side React in PHP. React is a user interface library developed by Facebook and Instagram to make building UIs simpler.

So you know about React and how to build your own components. And you know you can run JavaScript inside PHP scripts, thanks to v8js. So nothing can stop you from rendering React components on the server side in PHP. Which means you send the first view from the server and then continue from there.

He walks you through the process step-by-step, showing how to set up the environment for the components and make a test file you'll use to build the components. He includes the Javascript code to make a simple table based on given data. Using the V8J libraries, he makes an object, pushes the Javascript string into it and render it to a string by executing the code. A screenshot is included showing what the output should look like.

0 comments voice your opinion now!
react ui javascript tutorial interface inside

Link: http://www.phpied.com/server-side-react-with-php

Software Gunslinger:
PHP is meant to die, continued
April 26, 2013 @ 09:15:56

In his previous post ("PHP was meant to die") the point was made that PHP isn't really designed as a language to handle long running processes very well. It's made to handle a few operations and then die at the end of the request. In this follow up post he talks more about using PHP for long running processes and a library that could help.

Yes, I already acknowledged that PHP has a garbage collection implementation starting 5.3.0 and up (opt-in or opt-out, that's not the problem). I also acknowledge that garbage collection works, and is able to take care of most circular references just fine. [...] Anyway, as previously stated too, garbage collection is a great thing, but not enough for PHP. It's a borrowed feature that does not play well with old fundamental decisions inherited from the original design. Garbage collection is not a magical solution for every problem, like many tried to argue about. Let's illustrate with another example.

His example uses the React PHP library (a non-blocking I/O platform) to handle a lot of incoming data to a port and report back some memory usage and limit settings. He explains a bit about what's happening and shares the results of the test, including the end result - a fatal error when the memory limit was hit. He still comes to the same conclusion, ultimately...PHP is just not the language to use for long-running processes that do any large amount of work.

0 comments voice your opinion now!
react die longrunning process testing socket server memory limit

Link: http://software-gunslinger.tumblr.com/post/48215406921/php-is-meant-to-die-continued

Gonzalo Ayuso:
Enqueue Symfony's process components with PHP and ZeroMQ
April 09, 2013 @ 11:11:59

Gonzalo Ayuso has a new post today showing how he set up queuing with ZeroMQ and Symfony components and React.

Today I'd like to play with ZeroMQ. ZeroMQ is a great tool to work with sockets. I will show you the problem that I want to solve: One web application needs to execute background processes but I need to execute those processes in order. Two users cannot execute one process at the same time. OK, if we face to this problem we can use Gearman. I've written various posts about Gearman (here and here for example). But today I want to play with ZeroMQ.

He uses React and some ZeroMQ bindings and Symfony's Process component to make a simple client and server for working with the queue and processes. A screencast is included in the post showing them making the connection and adding the new process. The full code can be found on github (or installable via Composer)

0 comments voice your opinion now!
zeromq symfony component process react server client tutorial

Link: http://gonzalo123.com/2013/04/08/building-a-zeromq-enqueue-with-php

PHPMaster.com:
A First Look at React
March 26, 2013 @ 10:01:33

On PHPMaster.com there's a new tutorial that introduces you to React, the PHP-based event-driven non-blocking socket tool that's similar to some of the functionality Node.js provides. The article is a very basic introduction but can help get your feet wet with the tool.

For the past couple of years, Node.js has been drawing increasing amounts of attention as a promising web technology. While it has some strengths, like being event driven, some people just want to stick to PHP. For over a year now, however, there has been a similar project for PHP named React. React is mostly coded by Igor Wiedler, who is also a prominent contributor to the Silex framework. While reading through the React examples, it really does look similar to Node.js.

Included in the post are the instructions on how to get the latest version of React (via Composer) and the code to create a sample server that just writes out a string with a counter for the number of requests made. There's also an example of a "keystroke logger" for all data that's coming across the connection. The author (Igor) notes, however, that he wouldn't recommend using React in production, though, as its target is mostly those working with "cutting-edge technologies" rather than more stable applications.

0 comments voice your opinion now!
react tutorial introduction nodejs socket server example


Gonzalo Ayuso's Blog:
Database connection pooling with PHP and React (node.php)
May 21, 2012 @ 10:19:44

In this latest post Gonzalo Ayuso his recent experiences with <1 href="http://nodephp.org/">React (Node.js in PHP) and an example of how he worked up a script to pool database connections.

Last saturday I meet a new hype: "React" 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 connection pooling using gearman. Today the idea is the same but now with React.

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 over on github.

0 comments voice your opinion now!
react nodejs nodephp database connection pool


Sjon.Blog:
Protecting your property (PHP Encryption)
December 30, 2005 @ 07:15:19

There's always been several PHP developers out there looking to protect the source that they so lovingly crafted. They look for alternatives to keeping it safe, but sometimes it's just not enough. In this new post on the Sjon.Blog today, he mentions some of the frustrations he's had already with exectly this.

Zend almost convinced me that their Safeguard Suite really secured your PHP scripts. Ofcourse I know that scripts need to be interpreted and executed and are therefore never 100% safe; but I expected some form of obfuscation and rewriting to prevent this. This doesn't seem to be the case though. I have had a look at PHP Obfuscator/Obscurer, but a good illustration of the quality of that script can be illustrated with a simple, readable example.

Also, obfuscating React took me almost an hour; which isn't that strange when you have had a look at the sourcecode.

As far as I've heard/seen so far, there's not really a good solution to this dilema. Sure, some are better than others, but there's still a hole there that is just waiting to be filled with an application anyone can use...

0 comments voice your opinion now!
script encryption obfuscator React Zend Safeguard Suite script encryption obfuscator React Zend Safeguard Suite



Community Events











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


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

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