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

Sergey Zhuk:
Promise-Based Cache With ReactPHP
Sep 20, 2017 @ 10:11:55

Sergey Zhuk has written up a tutorial showing you how to implement promise-based caching with ReactPHP, a continuation of a previous post.

In the previous article, we have already touched caching (when caching DNS records). It is an asynchronous promise-based Cache Component. The idea behind this component is to provide a promise-based CacheInterface and instead of waiting for a result to be retrieved from a cache the client code gets a promise. If there is a value in a cache the fulfilled with this value promise is returned. If there is no value by a specified key the rejected promise returns.

He starts by defining the caching interface and how it would look in use to set/get a cache value. He shows how to update this with a "done" handler to output the value when the get is complete. He continues on showing how to use a fallback handler: either "otherwise" or "then". He also shows how these can be chained together to make more complex operations. The post ends with an example of this caching component in action and links to other library that use the same ideas.

tagged: promise cache reactphp get set tutorial component interface

Link: http://seregazhuk.github.io/2017/09/15/reactphp-cache/

Sergey Zhuk:
Cancelling ReactPHP Promises With Timers
Aug 31, 2017 @ 12:08:35

Sergey Zhuk has a new post to his site continuing on from a previous article about promises in ReactPHP. In this latest post he shows how you can use timers to cancel the execution of promises if their execution time grows too large.

At first, let’s refresh in memory what is Promise. A promise represents a result of an asynchronous operation. You can add fulfillment and error handlers to a promise object and they will be invoked once this operation has completed or failed. Check this article to learn more about promises.

Promise is a very powerful tool which allows us to pass around the code the eventual results of some deferred operation. But there is one problem with promises: they don’t give us much control.

He then shares the code required to make a simple "Hello world" promise and a handler for when it's cancelled. He then shows how to use the PromiseTimer functionality in ReactPHP to set a timeout on the promise instance and automatically call the cancellation event when it reaches that limit. He also includes a reminder that, in the cancellation handling of the promise it's a good idea to close out and cancel any other resources that may have been in use. The post ends with an example of how you can stack other functionality on the timeout using methods like "then" and "otherwise".

tagged: reactphp timer promise promisetimer tutorial asynchronous

Link: http://seregazhuk.github.io/2017/08/22/reactphp-promise-timers/

Michael Dowling:
Guzzle 5 and RingPHP
Oct 14, 2014 @ 10:52:25

Michael Dowling has a new post to his site today talking about the latest release for the Guzzle HTTP library and how it now works with RingPHP to make integration life easier. The RingPHP library, inspired by Clojure's Ring library, provides a low-level structure to work with HTTP clients and servers through a simple interface.

With RingPHP, Guzzle does not require cURL and can be used with any HTTP transport mechanism. I’d love to help anyone who is interested in creating RingPHP adapters to bind Guzzle to another library. For example, WyriHaximus on Github is working on binding Guzzle to ReactPHP. (In fact, Guzzle 4 did not require cURL, though it was much harder to use an alternate transport.)

He goes on to talk more about the changes in the Guzzle 5 release including more detail on the RingPHP integration, the use of promises/futures and iterable and callable streams. There's also several new events included in the release as well. He finishes out the post with an upgrade guide to help make the transition easier.

tagged: ringphp guzzle5 release http promise future psr7 streams events

Link: http://mtdowling.com/blog/2014/10/13/guzzle-5/

Zend Developer Zone:
Microsoft to extend Windows eco-system!
Feb 22, 2008 @ 13:58:00

On the Zend Developer Zone today, Andi Gutmans has written up a new post that, in light of a recent announcement from Microsoft about "going open source" with some of their products, asks what it means for the web and for the PHP community specifically.

Today Microsoft announced a significant initiative which aims to provide the developer community with access to a large number of Microsoft protocols and file formats. [...] With Microsoft opening up their specifications under the OSP, open-source communities like Zend Framework are now able to build such solutions without fear of litigation. There are many other areas where it will benefit open-source projects including Samba (SMB), FreeTDS (SQL Server), Mono (.NET), and others...

He shares his thoughts on the winners (Microsoft themselves, Open Source community) and losers (Microsoft's competitors, Linux) on the deal and the beneficial impact he thinks it will all have on the PHP.

tagged: windows opensource community specification promise

Link:

Marco van Hylckama Vlieg's Blog:
Which PHP framework holds a promise for the future?
Feb 23, 2006 @ 07:34:02

In this new post from Marco van Hylckama Vlieg, he asks a question of his readers - "Which PHP framework holds a promise for the future?"

I thought I'd throw in a question for a change! As I'm quite sure at least some of my readers are skilled PHP developers, some of them might be able to throw in some insightful remarks when it comes to the future of PHP5 and frameworks.

He mentions developers that are tired of "plumbing code" (the guts of the app), but havent found something in the PHP realm that fits. He mentions three frameworks specifically; Symfony, WASP, CakePHP.

tagged: framework holds promise future framework holds promise future

Link:

Marco van Hylckama Vlieg's Blog:
Which PHP framework holds a promise for the future?
Feb 23, 2006 @ 07:34:02

In this new post from Marco van Hylckama Vlieg, he asks a question of his readers - "Which PHP framework holds a promise for the future?"

I thought I'd throw in a question for a change! As I'm quite sure at least some of my readers are skilled PHP developers, some of them might be able to throw in some insightful remarks when it comes to the future of PHP5 and frameworks.

He mentions developers that are tired of "plumbing code" (the guts of the app), but havent found something in the PHP realm that fits. He mentions three frameworks specifically; Symfony, WASP, CakePHP.

tagged: framework holds promise future framework holds promise future

Link: