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

php[architect] Podcast:
Episode 10: Treasure, Old and New
May 28, 2018 @ 12:49:05

The php[architect] podcast has posted their latest episode of their podcast: Episode #10 - Treasure, Old and New with hosts Eric van Johnson and John Congdon.

Our hosts, Eric van Johnson and John Congdon review Treasure, Old & New which is the May 2018 issue of php[architect] magazine.

Eric and John discuss Deadpool, clean code, migrating to AWS, Packagist picks, BDD testing, and more. Oscar takes a look at recent Drupal and WordPress developments. An interview with Steve Grunwell, about Technical Debt, conference speaking, his work at Liquid Web, and more.

You can listen to this latest show either using the in-page audio player or by downloading the mp3 directly. Be sure to subscribe to their feed if you enjoy the show and want to be notified when future episodes are released.

tagged: old treasure ep10 podcast phparchitect new may2018

Link: https://www.phparch.com/podcast/episode-10-treasure-old-and-new/

Ayesh Karunaratne:
What's new and changing in PHP 7.3
Apr 23, 2018 @ 10:40:01

Looking forward to the next larger release of the PHP language - PHP 7.3 - Ayesh Karunaratne has written up a post on his site sharing some of the new things that are coming and changes that will be made.

This is a live document (until PHP 7.3 is released as generally available) on changes and new features to expect in PHP 7.3, with code examples, relevant RFCs, and the rationale behind them, in their chronological order.

Currently there are five items on his list of features/changes approved and implemented for the 7.3 release:

  • Heredoc and Nowdoc syntax requirements are more relaxed
  • Allow trailing comma in function and method calls
  • Option to make json_encode and json_decode throw exceptions on errors
  • References in list()
  • Introduced is_countable() function

While each item is a link to the actual RFC with more detail, he spends the rest of the post going through each and briefly outlining what they offer and code examples of them in use.

tagged: php73 feature rfc changing new list

Link: https://ayesh.me/Upgrade-PHP-7.3

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/

SitePoint PHP Blog:
What Are the New Features in Laravel 5.5?
Aug 14, 2017 @ 11:22:03

On the SitePoint PHP blog there's a recent article posted by Christopher Vundi looking at the new features coming in Laravel 5.5, the next major release of the popular PHP framework.

Laravel 5.5 will require PHP 7.0+. For the features this modern PHP version brings, please see our recap.

Laravel 5.5 will also be the next LTS (Long Term Support) release. This means bugfixes for two years and three years of security updates. That was also the case with Laravel 5.1, but its two-year window of bug fixes is coming to an end this year. Without further ado, let’s see what this new version has to offer.

Instead of just describing the new features, the article opts to walk you through the installation of v5.5 and showing examples of each. Topics covered include:

  • Rendering Mailables to the Browser
  • Exception Helper Functions
  • Introducing the migrate:fresh Command
  • Automatic Package Discovery
  • Whoops is Back!
  • Custom Exception Report Method
  • Validation Data Return
  • Custom Blade::if() Directives
  • Autoregistering of New Artisan Commands in the Kernel

...among many others. There's a long list of new features coming in this release and the tutorial covers each nicely and provides the code examples it would take to make it all work.

tagged: laravel new feature v55 framework example code

Link: https://www.sitepoint.com/new-features-laravel-5-5/

QaFoo Blog:
How You Can Successfully Ship New Code in a Legacy Codebase
Apr 21, 2017 @ 13:39:13

On the QaFoo blog there's a new post sharing some ideas on how you can add new code to a legacy application and ship it successfully without too much interruption to the current code.

Usually the problems software needs to solve get more complex over time. As the software itself needs to model this increased complexity it is often necessary to replace entire subsystems with more efficient or flexible solutions. Instead of starting from scratch whenever this happens (often!), a better solution is to refactor the existing code and therefore reducing the risk of losing existing business rules and knowledge.

[...] Instead of introducing a long running branch in your version control system (VCS) where you spend days and months of refactoring, you instead introduce an abstraction in your code-base and implement the branching part by selecting different implementations of this abstraction at runtime.

They then give a few examples of methods that can be use to get the new code in:

  • Replacing the Backend in a CMS
  • Rewriting a submodule without changing public API
  • Github reimplements Merge button

The final point is broken down into the process they recommend including the refactor of the current code, starting in on the new implementation and deleting the old code.

tagged: refactor ship new code legacy application tutorial

Link: https://qafoo.com/blog/101_branch_by_abstraction.html

Laravel News Podcast:
Episode #29: Welcome Jacob Bennett and Michael Dyrynda as the new hosts
Jan 19, 2017 @ 09:34:49

The Laravel News podcast has posted their latest episode, Episode #29, where they welcome the new hosts of the show Jacob Bennett and Michael Dyrynda.

Jacob Bennett and Michael Dyrynda will be taking over as hosts of the show going forward and this episode is a farewell from Jack and Eric and introductions of Jake and Michael.

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

tagged: laravelnews laravel podcast news ep29 new hosts

Link: https://laravel-news.com/podcast/29

SitePoint PHP Blog:
What’s New and Exciting in PHP 7.1?
Dec 09, 2016 @ 12:13:10

The SitePoint PHP blog has a new article posted sharing "what's new and exciting in PHP 7.1", the latest major version release in the PHP 7.x series. This version was released on December 1st of 2016.

The PHP community has gone viral with the latest PHP 7 announcement and all the goodies it brings to the language. The PHP 7.1 release has more good news and features to offer. This article highlights the most important ones, and you should check PHP RFC for the full list.

Included in their list of enhancements are features like:

  • the ArgumentCountError Exception
  • Nullable Types
  • the Iterable Type
  • Catching Multiple Exception Types
  • Invalid String Arithmetics

For each item on the list some brief code examples are provided, often showing the difference between the new behavior and previous PHP versions.

tagged: exciting new version php71 version release tutorial

Link: https://www.sitepoint.com/whats-new-and-exciting-in-php-7-1/

Fred Emmott:
Greenfield Projects with Hack
Nov 03, 2016 @ 12:14:06

Fred Emmott has a new post to his site sharing some of his experience with creating a "greenfield" project in Hack, the language Facebook developed to work with its HHVM runtime for PHP.

Until late 2015, the Hack and HHVM documentation site was a fork of PHP's own documentation site. This had many shortcomings, and ultimately we decided that the best approach would be something custom. As most of the public Hack code at that point was toy examples, we decided to also make the site itself open, and start investigating the greenfield problems.

There are 3 basic approaches to 'library code' in Hack if there isn't already a Hack version:

  • Use a PHP library, without typechecker support
  • Use a PHP library, and add HHI files so that Hack understands it
  • Write something new

The Hack/HHVM site uses a mix of all three, though mostly #2 and #3.

He talks some about using plain PHP libraries in Hack projects and how you won't get the full benefit of Hack's features without some of the type-checking enforced (sometimes required to get some libraries working). Following this he covers the integration of three projects/structures, changed a bit for supporting Hack: FastRoute, PHPUnit and the things based on the PSR-7 request/response structure. He wraps up the post talking about writing "something new" and things to consider to make its APIs more "Hack-like".

tagged: hack greenfield project new facebook hhvm fastroute phpunit psr7

Link: https://fredemmott.co.uk/blog/posts/greenfield-projects-with-hack

Symfony Blog:
The New Symfony Documentation Search Engine
Apr 29, 2016 @ 10:49:27

In an effort to improve their "developer experience" (DX) around using the Symfony framework the development team has introduced new searching functionality to help more effectively find what you're looking for in the expansive Symfony documentation.

Symfony boasts one of the largest documentation pools ever written for an Open- Source project. Considering the ten different Symfony versions (from 2.0 to master) and including the code samples, Symfony Documentation has around 3.6 million words, more than three times the word count of the entire Harry Potter series.

They share some of the things they learned around creating a search engine ("it's hard") and what they ultimately ended up using - the Algolia service. The post talks about how they indexed the current documentation and broke it up into "chunks" of meaningful content. They also include the simple Javascript they use that links the search field to the Algolia service and renders the results using a view partial.

The proof of concept for the new search engine was a success and we decided to stop the ElasticSearch integration and stick with Algolia. The new search engine is greatly faster than the previous one and the search results are more accurate and relevant.
tagged: symfony documentation search engine new algolia service

Link: http://symfony.com/blog/the-new-symfony-documentation-search-engine

Jeff Madsen:
Eloquent Create, Update, New...the Untold Story 2016-04-01
Apr 06, 2016 @ 12:19:20

Jeff Madsen has a quick post to his site with the "untold story" behind Eloquent's save and create in the Laravel framework.

Over on Laravel Quick Tips we've been looking at a few of these functions and their uses, and I thought it might be helpful to collect all of them together in a single (I hope) coherent post.

Without further preamble, let's get to it. I'm going to use the basic User object and table that ships with a default installation of Laravel so you can follow along if you like.

He starts with the difference between "new" and "create", pointing out the one fundamental difference: one saves, one does not. He then looks at some of the other new/create functions (like findOrNew, firstOrCreate, updateOrCreate), what each of them does in the background and a quick snippet of code showing.

tagged: eloquent laravel create update new behindthescenes difference save

Link: http://codebyjeff.com/blog/2016/04/eloquent-create-update-new-the-untold-story