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

Three Devs & A Maybe:
Contributing to PHP with Joe Watkins
Feb 21, 2017 @ 12:15:03

The Three Devs and a Maybe podcast has posted their latest episode featuring returning special guest Joe Watkins to talk about contributing back to the PHP language:

In this weeks episode we chat to good friend of the show Joe Watkins. We start off discussion with his recent work on creating a compute-node, dual WAN setup and accepted PHP Serbia talk on contributing to PHP without being a ‘C wizard’. From here we move on to mention some of the areas (bug tracking system and QA) that could be improved with the help of new contributors within the PHP internals ecosystem. Finally, we highlight several recently proposed RFCs, his opinions on them and some work he is doing on a future RFC.

You can listen to this latest episode either through the in-page audio player or by downloading the mp3 directly. If you enjoy the show be sure to also subscribe to their feed and follow the podcast on Twitter to get updates with new shows are released.

tagged: threedevsandamaybe podcast joewatkins contributing language

Link: http://threedevsandamaybe.com/contributing-to-php-with-joe-watkins/

Laravel News:
Laravel 5.5 Will Be The Next LTS Release
Feb 21, 2017 @ 11:26:28

According to this quick post on the Laravel News site the next version of the framework that will get long term support (LTS) will be version 5.5:

Version 5.1 was Laravel’s first LTS release and its two-year window of bug fixes are coming to an end this year. There have been a few people questioning if another LTS would be released and version 5.5 would be the next in line if it did happen.

Just today Laravel announced on Twitter that Laravel 5.5 will, in fact, continue the LTS line. [...] Just as the previous LTS this will include two years of bug fixes and three years of security updates.

Long term support means that the version will be "feature locked" on release but will continue to get bugfixes for issues found until the end of the maintenance window is reached.

tagged: laravel lts longtermsupport version announcement laravel55

Link: https://laravel-news.com/laravel-5-5-lts

Jeroen de Dauw:
Implementing the Clean Architecture
Feb 21, 2017 @ 10:41:45

In a recent post to his site Jeroen de Dauw looks at some of his own work and ideas around implementing clean architecture in PHP-based applications. The idea behind "clean architecture" is a focus on separation of concerns and dividing the systems into "layers" with contained logic in each.

Both Domain Driven Design and architectures such as the Clean Architecture and Hexagonal are often talked about. It’s hard to go to a conference on software development and not run into one of these topics. However it can be challenging to find good real-world examples. In this blog post I’ll introduce you to an application following the Clean Architecture and incorporating a lot of DDD patterns. The focus is on the key concepts of the Clean Architecture, and the most important lessons we learned implementing it.

In his post he looks at a real-world application (the Wikimedia Deutschland fundraising software) and how Domain Driven Design plays into the "clean" structure. He then walks through code examples, directory structures and lessons learned along the way (including bounded contexts and effective validation).

tagged: clean architecture tutorial guide domaindrivendesign designpattern

Link: https://www.entropywins.wtf/blog/2016/11/24/implementing-the-clean-architecture/

SitePoint PHP Blog:
Writing Async Libraries – Let’s Convert HTML to PDF
Feb 21, 2017 @ 09:58:05

The SitePoint PHP blog has another tutorial posted from author Christopher Pitt looking at writing async libraries with PHP. In this particular article he focuses on just one of many tasks an asynchronous library could perform: converting HTML to PDF documents.

I can barely remember a conference where the topic of asynchronous PHP wasn’t discussed. I am pleased that it’s so frequently spoken about these days. There’s a secret these speakers aren’t telling, though: "Making asynchronous servers, resolving domain names, interacting with file systems: these are the easy things. Making your own asynchronous libraries is hard. And it’s where you spend most of your time!"

The reason those easy things are easy is because they were the proof of concept – to make async PHP competitive with NodeJS. [...] Today, we’re going to look at a few ways to make your application code work well in an asynchronous architecture. Fret not – your code can still work in a synchronous architecture, so you don’t have to give anything up to learn this new skill. Apart from a bit of time…

He starts with some theory about things in the async world including callbacks, promises and what they might look like in PHP-land. He then starts in on the creation of the PDF files, creating a "Driver" class to handle some of the logic and using the Dompdf library to do the heavy lifting (the conversion from HTML to PDF). He walks through the code required for this class then moves on to the code, using the Amp project, to handle the async operations. He then creates a simple set of web accessible endpoints that call the Driver class with some basic attributes and performing the conversion. He ends the post talking about porting the parallel driver to other systems (such as ReactPHP) and a few simple steps if you need to move back to the synchronous world.

tagged: asynchronous conversion dompdf html pdf tutorial amp

Link: https://www.sitepoint.com/writing-async-libraries-lets-convert-html-to-pdf/

Community News:
Latest PECL Releases (02.21.2017)
Feb 21, 2017 @ 08:05:01

Latest PECL Releases:

  • sync 1.1.1
    - Fixed *NIX event object sync_WaitForUnixEvent() issues.

  • memcached 3.0.3
    PHP7 release of memcached extension. Note that support for libmemcached 0.x series has been discontinued and the oldest actively tested version is 1.0.2. It is highly recommended to use version 1.0.18 of libmemcached.

    Fixes

    • Fix crash when checking session data with older versions of libmemcached (#328)
    • Fix crash due to zend_mm_corrupted when fetching session data (#327)
  • v8 0.1.2
    This release adds script compilation and caching. Also more new methods added and some internal logic refactored. See detailed changes below.

    As of this release, V8 >= 5.8.168 required.

      • BC-breaking or potentially BC-breaking changes.

    Changes to public API and other important changes which may affect end-user:

    - * Add $is_wasm and $is_module options to V8ScriptOriginOptions and V8ScriptOrigin;
    - * Remove non-standard V8Scrip::{getSource,getOrigin};
    - * Remove V8ObjectValue::{Get,Set,Has,Delete,CreateDataProperty}Indexed methods;
    - * Remove non-working V8Context extensions support;
    - * Handle V8IntegerValue sub-types when returning values from V8, fixes #19;
    - Add V8UnboundScript class;
    - Add V8ScriptCompilerCachedData class;
    - Add V8ScriptCompilerCompileOptions class;
    - Add V8ScriptCompilerSource class;
    - Add V8ScriptCompiler;
    - Add V8SymbolValue::GetToPrimitive() method;
    - Add V8Value::IsNullOrUndefinedl() method;
    - Add more V8Value::Is*() methods;
    - Add V8MapObject;
    - Add V8SetObject;
    - Fix obj and func templates external memory adjusting.
    
  • amqp 1.8.0
    * Add SSL connection support (Bogdan Padalko) * Support for server method handling: confirms (publisher acknowledgments) and basic.return (Bogdan Padalko) * Add support for pkg-config (Remi Collet) * Preserve AMQP server error code for exceptions (Bogdan Padalko) * Add AMQPChannel::close() (Bogdan Padalko) * Fix segfault when deleting an unknown exchange (Bogdan Padalko) * Fix segfault with PHPUnit and xdebug for PHP 7 (Bogdan Padalko) * Add publisher confirms (Bogdan Padalko)

    For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.7.1...v1.8.0

  • PDO_INFORMIX 1.3.3
    Fixed compilation issue with the PHP 5.6 release.
tagged:

Link:

PHP.net:
PHP 7.1.2 Released
Feb 20, 2017 @ 12:15:32

The official PHP.net site has announced the release of the latest version in the PHP 7.1.x series: PHP 7.1.2:

The PHP development team announces the immediate availability of PHP 7.1.2. Several bugs have been fixed. All PHP 7.1 users are encouraged to upgrade to this version.

Bugs fixed include changes for DOM handling, FastCGI, hashing (adding http://php.net/hash_hkdf function), MySQL, OpenSSL and a good number of other locations. You can view the Changelog for the complete list. As always you can get this latest version from the main downloads page (source release) or windows.php.net for the Windows binaries.

tagged: language version release php71 minor bugfix

Link: http://php.net/index.php#id2017-02-17-1

Playing with RabbitMQ, PHP and node
Feb 20, 2017 @ 11:51:58

In the latest post to his site Gonzalo Ayuso shares some of the results of his "playing with RabbitMQ, PHP and node", creating a queue system that both languages could talk to easily.

I need to use RabbitMQ in one project. I’m a big fan of Gearman, but I must admit Rabbit is much more powerful. In this project I need to handle with PHP code and node, so I want to build a wrapper for those two languages. I don’t want to re-invent the wheel so I will use existing libraries (php-amqplib and amqplib for node).

Basically I need to use three things: First I need to create exchange channels to log different actions. I need to decouple those actions from the main code. I also need to create work queues to ensure those works are executed. It doesn’t matter if work is executed later but it must be executed. And finally RPC commands.

He goes through some of the basics of using RabbitMQ , showing the code for each of the languages - pushing a new value into the queue, registering workers, creating Queue builders and using an exchange and receiver to process the message. The post finishes with the last piece in his requirements: creating the functionality to handle RPC commands to get an answer back from the queue.

tagged: rabbitmq node tutorial integration nodejs queue

Link: https://gonzalo123.com/2017/02/20/playing-with-rabbitmq-php-and-node/

Laravel News:
Laravel Collection “tap” Method
Feb 20, 2017 @ 10:05:55

In this recent post to the Laravel News site Eric Barnes introduces a new method that's included in Laravel 5.4.10: the "tap" method.

Laravel 5.4.10 introduces a new tap method on collections which allow you to “tap” into the collection at a specific point and do something with the results while not affecting the main collection.

He includes an example, showing a sample array of user data and how, after converting it into a collection, he can "tap" into it at any point. He tapping pulls out the name of the current record following a "where" to locate the matching value. The quick post ends with a look at how the "tap" method is different from "pipe". Essentially the difference is that using "pipe" returns a different collection, potentially with modified data while "tap" does not.

tagged: laravel collection tap pipe method introduction

Link: https://laravel-news.com/collection-tap

That Podcast:
Episode #38 - Bullet
Feb 20, 2017 @ 09:42:51

That Podcast, hosted by Beau Simensen and Dave Marshall, has posted their latest episode - Episode #38: Bullet:

Beau and Dave discuss Sunshine PHP, Bullet Journaling, Mockery and Symfony Experiments.

Other topics mentioned include Moleskine notebooks, the Apple Pencil, Symfony's Backwards Compatibility Promise and Adobe Audition. You can listen to this latest episode either through the in-page audio player or by downloading it directly. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter for the latest updates when new shows are released.

tagged: thatpodcast ep38 bullet beausimensen davemarshall podcast

Link: https://thatpodcast.io/episodes/episode-38-bullet

SitePoint PHP Blog:
Achieving Modular Architecture with Forwarding Decorators
Feb 17, 2017 @ 13:46:51

The SitePoint PHP blog has a tutorial posted from author Eugene Dementjev covering the use of "forwarding decorators" to create a more modular architecture for your application.

As your web application becomes larger, you certainly start to think more about designing a flexible, modular architecture which is meant to allow for a high amount of extensibility. There are lots of ways to implement such architecture, and all of them circle around the fundamental principles: separation of concerns, self-sufficiency, composability of the parts of an app.

There is one approach which is rarely seen in PHP software but can be effectively implemented — it involves using native inheritance to provide manageable patching of the software code; we call it the Forwarding Decorator.

The post starts out by defining the modular architecture and some of the basic concepts involved (including a flow graph or two). Then comes the examples - how as basic version of the system could be used, multiple modules modifying a single class and hooks/patching the code.

tagged: modular architecture forwarding decorators tutorial designpattern

Link: https://www.sitepoint.com/achieving-modular-architecture-with-forwarding-decorators/