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

Cees-Jan Kiewiet:
React/cache in use
Sep 10, 2018 @ 17:55:11

In a new post to his site Cees-Jan Kiewiet shares details about the latest version of the React/Cache component for the ReactPHP library. In the tutorial he covers the library, what this update brings with it and how he's making use of it.

Recently we, ReactPHP, released 0.5 of our cache package with TTL and other PSR-16 similarities. In this post we'll go over which packages I recently updated and how I am using them in my sites.

He breaks the post up into a few different sections showing the caching in use:

  • JSON and msgpack
  • Redis
  • Fallback
  • react/http session middleware
  • react/http webroot preload middleware

For each item in the list there's a bit of code showing it in action and some explanation as to what it's doing and how it helps.

tagged: reactphp reactcache example redis fallback middleware json msgpack

Link: https://blog.wyrihaximus.net/2018/09/react-cache-0-5/

Christoph Rumpel:
Build a newsletter chatbot in PHP - Part 3
Mar 27, 2018 @ 15:57:24

Christoph Rumpel has continued his series covering the creation of a chatbot using the Botman package in a new post to his site. The latest post, part three in the series, builds on the base created in parts one and two and integrates the bot with his project website.

In part one and two we created a Facebook Messenger chatbot that let your users subscribe to your newsletter. We stored that information in the database and sent out our first newsletter. In the last third part, we integrate this bot to a website and write our first tests.

He then walks you through the process of using the Facebook Customer Chat Plugin to integrate it into the site (using the Facebook JavaScript SDK). He includes instructions on whitelisting your domain and including the plugin into the site's source using a few custom configuration options. With the integration complete he then takes a step back and shows the creation of several tests evaluating the fallback handling and subscription conversation responses.

tagged: chatbot tutorial series part3 integrate facebook testing fallback subscribe

Link: https://christoph-rumpel.com/2018/03/build-a-newsletter-chatbot-in-php-part-3

Rob Allen:
ZendInput fallback value
Aug 11, 2015 @ 17:49:26

Rob Allen has posted another article about the ZendInput component of the Zend Framework (he talks about empty values here) this time covering the use of fallback values when the input doesn't contain the needed data.

Recently an issue was reported against ZendInputFilter where the reporter has discovered a regression where the fallback value wasn't being populated correctly. ?Matthew investigated, fixed it and asked me to review it. I was fascinated as I didn't realise (or had completely forgotten!) that ZendInput and ZendInputFilter supported fallback values so I looked into it and it turns out that it's simple and works exactly as its name implies.

He includes a simple example of a fallback for a name value set using the setFallback method on the Input object. He does point out one "wrinkle" in the functionality, however, dependent on the values set for required, allow_empty and continue_if_empty. Certain combinations could make the value either be returned differently than expected or not at all. He includes a small test script that shows the various combinations and what their expected output should look like.

tagged: zendinput fallback value zendframework2 tutorial

Link: http://akrabat.com/zendinput-fallback-value/


Trending Topics: