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

PHP 7.1.14 Released
Feb 06, 2018 @ 12:39:41

On the main PHP.net site today there's an announcement about the latest release in the PHP 7.1.x series: PHP 7.1.4.

The PHP development team announces the immediate availability of PHP 7.1.14. This is a bugfix release. Several bugs were fixed in this release.

All PHP 7.1 users are encouraged to upgrade to this version.

Fixes in this latest release include changes to FastCGI handling, IMAP functionality, RecursiveArrayIterator in the SPL and a connection fix for PostgreSQL. You can see the full list of changes and their related bugs in the full Changelog. This version is available for download form the usual locations: the main downloads page for the source packages and windows.php.net for the Windows binaries.

tagged: language release bugfix php71

Link: http://php.net/index.php#id2018-02-01-2

Matin Hujer:
Consistence brings consistency to the PHP
Feb 06, 2018 @ 10:50:05

On his site today Matin Hujer has posted a tutorial covering the use of the Consistence library, a package that is designed to provide a consistent interface to PHP's functionality.

There is no argument, that PHP can sometimes be a bit inconsistent about naming stuff and maintaining order of parameters for related functions. Also, in some cases it is not strict and allows you to use the language and the functions in a wrong way. Sometimes you get false as a return value where an exception would be appropriate.

[...] Consistence provides opinionated strict wrappers with better error handling and consistent naming and consistent parameters order.

The remainder of the post goes through some of the functionality the package provides including:

  • Enums for better type safety
  • [Using] ObjectPrototype to disable magic methods
  • Consistent array manipulation functions
  • [Working with] Regular expressions

As a related piece he's also created PHPStan static analysis rules for the library to ensure it's being used correctly.

tagged: language consistency package library tutorial

Link: https://blog.martinhujer.cz/consistence-brings-consistency-to-the-php/

Sergey Zhuk:
Asynchronous PHP: Why?
Feb 02, 2018 @ 11:15:38

In a post to his site Sergey Zhuk shares his opinion on asynchronous PHP and why it's in such demand these days in web-based applications.

Asynchronous programming is on demand today. Especially in web-development where responsiveness of the application plays a huge role. No one wants to waste their time and to wait for a freezing application, while you are performing some database queries, sending an email or running some other potentially long-running tasks.

Users want to receive responses to their actions, and they want these responses immediately. When your application becomes slow, you start losing your clients. Once a user has to deal with a freezing application, in most cases he or she simply closes it and never returns. When the UI freezes from the user’s point of view, it is not clear if your application is broken, or it is performing some long-running task and requires some time for it.

He goes on to talk about the importance of responsiveness in web applications and clearing up the difference between running tasks in parallel and running them asynchronously. He also talks briefly about the use of asynchronous processing on the backend and how it compares to other technology (like Node.js and Go) that have built-in asynchronous processing.

tagged: asynchronous processing responsive parallel backend language

Link: http://sergeyzhuk.me/2018/02/02/why-asynchronous-php/

PHP 7.2.2 Released
Feb 01, 2018 @ 10:16:33

On the main PHP.net site they've posted an announcement about the latest release in the current major version of the language: PHP 7.2.2

The PHP development team announces the immediate availability of PHP 7.2.2. This is a bugfix release, with several bug fixes included.

Bugs fixed in this release include issues in the FastCGI handling, IMAP, Opcache, PDO, PostgreSQL, SOAP, Zip and several core language changes. You can see the full list of updates and links to their related bugs in the full Changelog. It is recommended that all PHP 7.2 users upgrade to this release. As always it can be downloaded from the main downloads page for the source packages and windows.php.net for the Windows binaries.

tagged: language release bugfix php72

Link: http://php.net/index.php#id2018-02-01-1

Exakat Blog:
PHP assertions and their usage
Jan 18, 2018 @ 11:16:58

On the Exakat blog there's a post that covers assertions in PHP, a built-in tool the language provides to help perform simple value based evaluation against certain criteria.

PHP has a clever native debugging tool : the PHP assertions. In a nutshell, assertions are a function call to assert(), that triggers an error when a condition is not satisfied.

[...] Unlike debugging conditions, the assert() syntax has to be read in a positive way. When the condition, aka as the first argument, is satisfied, all is fine, and process goes on; when the condition is not satisfied, then an error is triggered: the message of the error is the second argument.

The post then gets into more detail about the assertions, noting that the result has to be positive and that they can be somewhat configured (basically turned on/off and the error level can be adjusted). It also covers some examples of things to test with assertions, how they should be treated as debugging and to avoid using them on resources outside the code (like database connections).

tagged: assertion usage language native tutorial introduction

Link: https://www.exakat.io/php-assertions-usage/

Brandon Savage:
What version of PHP should my package support?
Jan 10, 2018 @ 10:09:46

In a post to his site Brandon Savage shares some of his thoughts about PHP package development and suggests how to figure out what versions of the PHP language it should support.

Everybody likes “the new hotness.” [...] Perhaps, then, it shouldn’t be so surprising that people get tremendously excited when a new version of PHP comes out. People look forward to the new features, whether they be the trailing commas in list() syntax or counting of non-countable objects.

[...] A new version of PHP can pose challenges to open source package maintainers. There are questions, like what is the minimum version we will support and how soon can we take advantage of the new features we’ve been waiting on? I want to offer up some thoughts, both as a package maintainer and a user of many open source packages.

He goes on to suggest that package authors should support down to the last currently supported version of the language (v5.6 at the time of this post). This allows users of the package that may be restricted and don't have the "new hotness" to keep using the package. He points out that this doesn't mean that you shouldn't use new features, just that older versions should be supported along with the newer ones for those depending on the package. He makes three suggestions as to how he thinks package maintainers should approach the issue:

  • maintainers should feel comfortable in bumping up the requirement to the latest (in a major release)
  • maintainers should also ensure that the support is still there for older versions that can't use the newer features
  • maintainers should bump up this minimum version when it falls out of active support
Supporting old versions of a language isn’t fun and isn’t glamorous. But it’s important. It’s important because there’a segment of the population who can’t upgrade yet. It’s important to make components accessible to a larger, broader audience who is struggling to find best practices and use modern packages. And it’s important for those users who are tied to a legacy version, and are struggling to get upgraded. But it’s the right thing to do for the community.
tagged: package version language support opinion maintainer old new

Link: https://www.brandonsavage.net/version-php-package-support/

Multiple Versions Released - 5.6.33, 7.1.13, 7.2.1 and 7.0.27
Jan 05, 2018 @ 10:16:17

On the [main PHP.net site]http://php.net/() today they've announced the release of new released of all currently supported versions of the language:

All of these releases contain similar bugfixes correcting security issues reported in the language including problems in the CLI server, Phar handling, Zip functionality and the Opcache feature. It is suggested to update to these latest versions as soon as possible to prevent issues with these bugs.

As always you can download the source versions of these latest releases from the main downloads page or the Windows binaries from windows.php.net. If you're interested in the changes made, check out the Changelogs for PHP 7 and PHP 5.6.

tagged: version release language php56 php71 php72 security bugfix

Link: http://php.net/downloads

Jeff Madsen:
Using Laravel Translation Strings in Vue.js
Dec 28, 2017 @ 09:51:02

Jeff Madsen has a new post to his site showing you how integrate Laravel's translations strings with a Vue.js frontend making it simpler to maintain only one source for the translation of content in your application.

One issue you will face if you need to make a multi-lingual site is how to keep your translations organized for both your back-end framework and your javascript components. I’m going to demonstrate the basic technique for this, using Laravel and Vue.js for my example.

While his examples make use of Laravel and Vue.js, the approach is agnostic of most tools and could be modified to integrate with other technologies pretty easily. He builds a system where the translations are kept in PHP files which are converted into something Vue can read and use. He starts with the backend, showing how to use Laravel's localization functionality to set up the files and shift between languages. He then makes use of the lang.js library to pull the contents of these files into Vue and adds in a bit of code to push those values into components.

tagged: vuejs language translation tutorial string laravel

Link: https://medium.com/@codebyjeff/using-laravel-translation-strings-in-vue-js-e2e35b7aafca

Marcel Pociot:
2017 - A PHP Year in Review
Dec 26, 2017 @ 09:39:40

Marcel Pociot has written up a post to finish out 2017 and provide a year in review for the community and language via some Github statistics.

It's this time of the year again - the end of the year is coming up fast, so why not step back and take a look at what we, as a PHP community, have achieved this year?

For these statistics, I used the free GitHub Archive data in combination with Google BigQuery, which lets you process 1TB of data per month free of charge.

So let's take a look at some numbers

He first breaks it up into three main categories:

  • most starred PHP repositories
  • most starred new PHP repositories
  • most contributed PHP repositories

From there he "digs deeper" and looks at the packages requiring the most dependencies and graphs the frameworks according to how many dependencies they require to install.

tagged: yearinreview language github repositories starred dependency

Link: http://marcelpociot.de/blog/2017-12-21-a-php-year-in-review

Domain-Driven Design - Model
Dec 18, 2017 @ 09:03:21

On the Pehapkari.cz blog they've continued their "Domain-Driven Design" series with the latest post focusing on models.

All of us model every day. A friend tells us a joke, we imagine the situation and if we model it as is intended, we find the situation funny. A customer wants to have a new functionality and while he speaks, we try to imagine what does the customer wants - we model.

We are going to take a look at what is software modeling, how can we express the model and how can we capture key concepts.

The post starts off with an overview of what "modeling" is to get everyone on the same page. It also talks about validation of the model by domain experts and some questions to ask to ensure the model provides the right data. They include a more practical example of a shopping cart and some key concepts and constraints that might come along with it. Some illustrations are included in the post to help give a bit more visual context to the contents.

tagged: domaindrivendesign domain language model series part2

Link: https://pehapkari.cz/blog/2017/12/16/domain-driven-design-model/