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

Community News:
Latest PECL Releases (09.19.2017)
Sep 19, 2017 @ 08:05:01

Latest PECL Releases:

  • SeasLog 1.7.6
    - Fixed analyzerDetail bug, use grep -ai key_words.

    • Fixed issue #152. Segfault in cli.
  • SeasLog 1.7.5
    - Update license from Apache License 2.0 to PHP License 3.01. - Support send to Rsyslog(TCP/UDP) with RFC5424. - Support RequestId differentiated requests to fixed issue #134. - Support for log template customizations to fixed issue #12 #143. - Update SeasLog Analyzer scripts version to 1.1.0, to fixed issue #139. - Optimization of analyzerCount and analyzerDetail to fixed issue #133. - Fixed issue #138. Error by file exists. - Fixed issue #140. Error by setDatetimeFormat. - Fixed issue #142. Error by too many open files. - Fixed issue #144. Error by read log detail order desc. - Fixed issue #145. Error by analyzerDetail. - Fixed issue #146. Segfault at php-fpm.
  • gRPC 1.6.0
    - License changed to Apache 2.0 - Added support for php_namespace option in codegen plugin #11886 - Updated gRPC C Core library version 1.6
  • parle 0.6.1
    - Removed FLAG_REGEX_* prefix from the lexer flag constants - Removed non worky rexeg from range signature for pushMacro method
  • parle 0.6.0
    - Fix consistency of return type in 7.0/7.1/7.2 (Remi Collet) - Fix memory leak in ParleStack - Max parser id is set to UINT16_MAX to save memory. This might be changed in the future - Push signatures accepting string range for regex was removed as ZPP would deliver copies anyway - Turned Lexer methods bol, flags and state into properties - Turned Parser methods action and reduceId into properties - Turned Stack methods empty and size into properties
  • mongodb 1.3.0RC1
    ** Bug * [PHPC-994] - Fix HAVE_SOCKLEN_T macro redefinition for Windows builds * [PHPC-1005] - Ensure array symtable converts to object proptable in PHP 7.2 * [PHPC-1006] - Do not modify memory of Persistable::bsonSerialize() return value

    ** Task * [PHPC-996] - Remove support for PHP 5.4 * [PHPC-997] - Update date/time handling code due to changes in timelib * [PHPC-1004] - Rename ObjectID to ObjectId * [PHPC-1007] - Upgrade libbson and libmongoc to 1.8.0 * [PHPC-1008] - Use SETUP_OPENSSL() in config.w32 if available

    ** Improvement * [PHPC-1001] - Report field name for invalid UTF-8 and unsupported zval types during BSON encoding

  • mongodb 1.3.0beta2
    ** Bug * [PHPC-994] - Fix HAVE_SOCKLEN_T macro redefinition for Windows builds * [PHPC-1005] - Ensure array symtable converts to object proptable in PHP 7.2 * [PHPC-1006] - Do not modify memory of Persistable::bsonSerialize() return value

    ** Task * [PHPC-996] - Remove support for PHP 5.4 * [PHPC-997] - Update date/time handling code due to changes in timelib * [PHPC-1004] - Rename ObjectID to ObjectId * [PHPC-1007] - Upgrade libbson and libmongoc to 1.8.0 * [PHPC-1008] - Use SETUP_OPENSSL() in config.w32 if available

    ** Improvement * [PHPC-1001] - Report field name for invalid UTF-8 and unsupported zval types during BSON encoding

  • redis 3.1.4RC3
    phpredis 3.1.4RC3

    The primary new feature phpredis 3.1.4 is the ability to send MULTI .. EXEC blocks in pipeline mode. There are also many bugfixes and minor improvements to the api, listed below:

    • Allow mixing MULTI and PIPELINE modes (experimental)! [5874b0] (Pavlo Yatsukhnenko)

    • Added integration for coverty static analysis and fixed several warnings [faac8b0, eff7398, 4766c25, 0438ab4, 1e0b065, 733732a, 26eeda5, 735025, 42f1c9, af71d4] (Pavlo Yatsukhnenko)

    • Fixed link to redis cluster documentation [3b0b06] (Pavlo Yatsukhnenko)

    • Remove unused PHP_RINIT and PHP_RSHUTDOWN functions [c760bf] (Pavlo Yatsukhnenko)

    • Removed duplicate HGET in redis array hash table, formatting [d0b9c5] (Pavlo Yatsukhnenko)

    • Treat NULL bulk as success for session read [659450] (Pavlo Yatsukhnenko)

    • Refactor redis_send_discard [ea15ce] (Pavlo Yatsukhnenko)

    • Updated runtime exception handling [8dcaa4, 7c1407] (Pavlo Yatsukhnenko)

    • Added a github issue template [61aba9] (Pavlo Yatsukhnenko)

    • Initialize gc member of zend_string [37f569) (Pavlo Yatsukhnenko)

    • Fix valgrind warnings [471ce07, 1ab89e1, b624a8b] (Pavlo Yatsukhnenko)

    • Fix php5/php7 compatibility layer [1ab89e, 4e3225] (Pavlo Yatsukhnenko)

    • Fix typo in README.markdown [e47e44] (Mark Shehata)

    • Improve redis array rehash [577a91] (Pavlo Yatsukhnenko)

    • Change redis array pure_cmds from zval to hashtable [a56ed7] (Pavlo Yatsukhnenko)

    • Don't try to set TCP_NODELAY on a unix socket and don't warn on multiple calls to pipeline [d11798, 77aeba] (Michael Grunder)

    • Use zend_string rather than char* for various context fields (err, prefix, etc) [2bf7b2] (Pavlo Yatsukhnenko)

    • Various other library fixes [142b51, 4452f6, e672f4, 658ee3, c9df77, 4a0a46] (Pavlo Yatsukhnenko)

  • redis 3.1.4RC2
    phpredis 3.1.4RC2

    The primary new feature phpredis 3.1.4 is the ability to send MULTI .. EXEC blocks in pipeline mode. There are also many bugfixes and minor improvements to the api, listed below:

    • Allow mixing MULTI and PIPELINE modes (experimental)! [5874b0] (Pavlo Yatsukhnenko)

    • Added integration for coverty static analysis and fixed several warnings [faac8b0, eff7398, 4766c25, 0438ab4, 1e0b065, 733732a, 26eeda5, 735025, 42f1c9, af71d4] (Pavlo Yatsukhnenko)

    • Fixed link to redis cluster documentation [3b0b06] (Pavlo Yatsukhnenko)

    • Remove unused PHP_RINIT and PHP_RSHUTDOWN functions [c760bf] (Pavlo Yatsukhnenko)

    • Removed duplicate HGET in redis array hash table, formatting [d0b9c5] (Pavlo Yatsukhnenko)

    • Treat NULL bulk as success for session read [659450] (Pavlo Yatsukhnenko)

    • Refactor redis_send_discard [ea15ce] (Pavlo Yatsukhnenko)

    • Updated runtime exception handling [8dcaa4, 7c1407] (Pavlo Yatsukhnenko)

    • Added a github issue template [61aba9] (Pavlo Yatsukhnenko)

    • Initialize gc member of zend_string [37f569) (Pavlo Yatsukhnenko)

    • Fix valgrind warnings [471ce07, 1ab89e1, b624a8b] (Pavlo Yatsukhnenko)

    • Fix php5/php7 compatibility layer [1ab89e, 4e3225] (Pavlo Yatsukhnenko)

    • Fix typo in README.markdown [e47e44] (Mark Shehata)

    • Improve redis array rehash [577a91] (Pavlo Yatsukhnenko)

    • Change redis array pure_cmds from zval to hashtable [a56ed7] (Pavlo Yatsukhnenko)

    • Don't try to set TCP_NODELAY on a unix socket and don't warn on multiple calls to pipeline [d11798, 77aeba] (Michael Grunder)

    • Use zend_string rather than char* for various context fields (err, prefix, etc) [2bf7b2] (Pavlo Yatsukhnenko)

    • Various other library fixes [142b51, 4452f6, e672f4, 658ee3, c9df77, 4a0a46] (Pavlo Yatsukhnenko)

tagged:

Link:

Peter Lafferty:
HTTP Request Validation With Silex
Sep 18, 2017 @ 12:15:48

On his Medium blog Peter Lafferty has written up a post showing you a method for HTTP request validation in Silex, the microframework from the creators of Symfony.

This article covers three validation scenarios: routes, query strings [and] POST with a JSON body.

He starts with a simple Silex application that creates a "RESTful" API with endpoints providing emojis back when queried (three endpoints). He then uses this to show how to validate:

  • routes for their expected values in the URL
  • using a ValidatorService provider to build a set of assertions (GET request)
  • using the same service to create assertions for the JSON content of a POST request

All code required is included in the post including the correct handling of the emoji output via a UTF-8 JSON response handler.

tagged: http validation silex tutorial service assert url get post

Link: https://medium.com/@peter.lafferty/http-request-validation-with-silex-9ebd7fb37f37

Dragos Holban:
How to Setup Docker for Your Symfony Project
Sep 18, 2017 @ 11:48:31

In a tutorial posted to his Medium.com site Dragos Holban continues his series walking you through Symfony for PHP applications. In this latest part of the series he shows you how to use Docker to set up an environment for a Symfony-based application.

As you probably know, I am a big Symfony fan :) In the last few years I used Vagrant to set up my Symfony development environment more or less as described here. But we now have Docker and it’s time to move forward with a new setup. Docker containers are generally more lightweight than Vagrant virtual machines, so starting and stopping them is extremely fast. They also take a lot less disk space.

He starts by sharing an example Dockerfile and docker-compose.yml to help set up and configure the environment to be ready for use. The configuration sets up Apache, PHP 7, MySQL, git, Composer and several PHP extensions. It then installs a fresh instance of Symfony and runs a bash file to finish the setup. He shares the contents of this file and the VirtualHost configuration for the web server. Finally he shows how to run the setup via the Docker command line tool and what you can expect to see when things are running smoothly.

tagged: docker symfony setup configure dockerfile compose tutorial series

Link: https://medium.com/@dragosholban/how-to-setup-docker-for-your-symfony-project-ff9b1bf44e68

Laravel News:
Testing With PhpSpec
Sep 18, 2017 @ 10:22:26

On the Laravel News site there's a new tutorial posted introducing you to testing with PhpSpec, a specification-driven testing tool that helps you model the specification your application needs to match.

PhpSpec is a testing tool based on the concept of emergent design using specification. You may have heard of Behavior Driven Development (BDD), and PhpSpec is a tool to use at the spec level or SpecBDD. We also mentioned PhpSpec in our recent roundup of Laravel Testing Resources, which includes ways you can incorporate PhpSpec into your Laravel workflow if you are interested in trying out SpecBDD.

If you’ve never tried PhpSpec, one of the things that I love about PhpSpec is that the process generates code for you and guides you through the SpecBDD process through the command line. Let me show you what I mean with a quick tutorial.

The tutorial then walks you through the installation of PhpSpec and how to run it from the command line before making any tests. They then walk through the configuration of the tool and share a sample workflow with seven steps including describing a specification, writing out expected behavior and verifying the behavior. Code examples (and command line calls) are included in each step of the way, defining an example "calendar" specification with the common functionality (add, subtract, divide, etc). The post finishes with some links to where you can find more information about PhpSpec and spec driven development.

tagged: phpspec specification testing calculator tutorial development

Link: https://laravel-news.com/testing-with-phpspec

Alejandro Celaya:
The PhpStorm plugins of my choice
Sep 18, 2017 @ 09:17:33

In a new post to his site Alejandro Celaya has shared some of the PhpStorm plugins he makes use of in his day-to-day development on PHP applications. Some of them have to do with PHP itself but several help with more generic development needs.

Earlier last week I found a github repository which collects different resources related with the full post for more information.

tagged: phpstorm plugin development tool favorite opinion

Link: https://blog.alejandrocelaya.com/2017/09/16/the-phpstorm-plugins-of-my-choice/

SitePoint PHP Blog:
Game Development with React and PHP: How Compatible Are They?
Sep 15, 2017 @ 12:43:52

The SitePoint PHP blog has posted a new tutorial from Christopher Pitt that tries to answer the question wondering if React and PHP are compatible for game development.

“I’d like to make a multiplayer, economy-based game. Something like Stardew Valley, but with none of the befriending aspects and a player-based economy.”

I started thinking about this the moment I decided to try and build a game using PHP and React. The trouble is, I knew nothing about the dynamics of multiplayer games, or how to think about and implement player-based economies. I wasn’t even sure I knew enough about React to justify using it.

I once watched a talk by dead_lugosi, where she described building a medieval game in PHP. Margaret inspired me, and that talk was one of the things that led to me writing <a href="https://www.amazon.com/dp/1484224922>a book about JS game development. I became determined to write about my experience. Perhaps others could learn from my mistakes in this case, too.

With the foundation laid, he starts in on the setup of the backend for the game: a PHP server running a server compatible with multiple websocket (React) requests. He chose Aerys for the HTTP and websocket functionality and includes the code to create the server and the packages he required. He shares some of the code to create the server and a "Hello world" endpoint the frontend will use. He then moves over to the frontend side of things, showing the packages he installed via NPM and the Laravel Mix configuration to use Webpack to bundle up the files required. He then walks through the integration of the front and back end code including the connection of the websockets.

For those that want to see the end result all together he has posted it to GitHub in a complete form for this part of the series.

tagged: react tutorial reactphp game development part1 series websocket

Link: https://www.sitepoint.com/game-development-with-reactjs-and-php-how-compatible-are-they/

Laravel News:
Laravel 5.5 Now Includes TrustedProxy
Sep 15, 2017 @ 11:07:03

On the Laravel News site there's a new post about a feature introduced in version 5.5 of the popular PHP framework: a proxy that's included by default as a part of the TrustedProxy feature.

Laravel v5.5 was released just a week ago at Laracon EU. You may have noticed that the v5.5 composer.json file requires the similar functionality Symfony has).

tagged: laravel proxy package feature cloudflare tutorial framework

Link: https://laravel-news.com/trusted-proxy

PHP.net:
PHP 7.2.0 Release Candidate 2 Released
Sep 15, 2017 @ 10:48:28

On the PHP.net site they've posted an announcement about the latest Release Candidate of the language for the PHP 7.2.x series: PHP 7.2.0 Release Candidate 2.

The PHP development team announces the immediate availability of PHP 7.2.0 RC2. This release is the second Release Candidate for 7.2.0. All users of PHP are encouraged to test this version carefully, and report any bugs and incompatibilities in the bug tracking system.

[...] For more information on the new features and other changes, you can read the NEWS file, or the UPGRADING file for a complete list of upgrading notes. These files can also be found in the release archive.

You can download this latest pre-release version from either the source downloads or Windows site for the Windows binaries. The next release candidate will be posted on September 28th according to the release schedule with a few more to follow to work out all of the potential issues in this next major release of the language.

tagged: php language release php72 releasecandidate php72rc2 preview

Link: http://php.net/index.php#id2017-09-14-1

Zend Framework Blog:
Emitting Responses with Diactoros
Sep 15, 2017 @ 09:14:05

On the Zend Framework blog they've posted a tutorial from project lead Matthew Weier O'Phinney showing how to use the Diactoros package to create response emitters. These emitters are just methods of output related to HTTP handling (like headers, response codes and normal text output).

When writing middleware-based applications, at some point you will need to emit your response.

PSR-7 defines the various interfaces related to HTTP messages, but does not define how they will be used. Diactoros defines several utility classes for these purposes, including a ServerRequestFactory for generating a ServerRequest instance from the PHP SAPI in use, and a set of emitters, for emitting responses back to the client. In this post, we'll detail the purpose of emitters, the emitters shipped with Diactoros, and some strategies for emitting content to your users.

He starts by describing what "emitters" are in the context of PSR-7 applications and shows the code definition of the EmitterInterface, the base of all emitter classes. After covering some of the emitters that Diactoros includes he shows how to create one to emit file information and how you can mix and match them in a emitter "stack" to perform more that one operation on the output.

tagged: diactoros tutorial emitter response output example interface

Link: https://framework.zend.com/blog/2017-09-14-diactoros-emitters.html