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

Symfony Blog:
New in Symfony 4.2
Oct 05, 2018 @ 17:06:50

Over the past several weeks the Symfony project blog has released a series of posts detailing new features in the 4.2 release of the framework. Here's the current listing of those posts:

Each post includes a summary of the changes or additions and some example code and configuration showing it in use.

tagged: symfony framework feature component update addition list

Link: https://symfony.com/blog/

Cloudways Blog:
What’s New in PHP 7.3: A Look at Initial RFC
Oct 04, 2018 @ 18:07:45

If you're looking for a good summary of what's coming up in the next major version of PHP (v7.3), look no further than this new post from the Cloudways blog.

PHP is surely giving a tough competition to other scripting languages, thanks to the developers for the rapid updates they unleash from time to time. [...] In the series of these updates, PHP recently has got another milestone with the release of RC1 of PHP 7.3. The version also got some new much-needed updates. While the official release date of PHP 7.3 is given of late December 2018.

In this blog, I will discuss newly introduced PHP 7.3 features and updates.

The post then goes through several of the improvements and new features, providing code examples and descriptions for:

  • Flexible Heredoc and Nowdoc Syntaxes
  • the PCRE2 Migration
  • is_countable function
  • Argon2 Password Hash Enhancements
  • Same Site Cookie

...just to name a few. There are several others included in the post as well. While PHP 7.3 hasn't been released as a final version yet, you can test these changes out via the current release candidate in your development: PHP 7.3.0RC2. Additionally, more information about the RFCs - including those that weren't accepted - can be found on the PHP wiki.

tagged: tutorial php73 feature update rfc php73rc2 development

Link: https://www.cloudways.com/blog/whats-new-in-php-7-3/

Laravel News:
Typed Properties Coming to PHP 7.4
Oct 02, 2018 @ 16:49:02

On the Laravel News site, there's a post talking about a feature that's coming in PHP 7.4: typed properties. It covers some of the basics of what they are and how they can help improve your code.

The Typed Properties 2.0 RFC was accepted with a vote of 70 in favor and one no vote. A 2/3 majority is required because typed properties is a language change. The typed property change is a PHP 7.4 proposal.

The post quotes the purpose of the feature from the RFC and provides an example of how most developers ensure property type safety now: via getters and setters. They then show a refactored version of this with typed properties, making for a much shorter class definition. They also include a code snippet showing all of the possible types you can use with the typed property functionality. They finish the post with a few of their own thoughts about string typing versus weak typing in PHP and link to the pull request that's in progress to implement the feature.

tagged: typed properties feature language php74

Link: https://laravel-news.com/php7-typed-properties

Tomas Votruba:
New in Symplify 5: 3 New Cool Features of PackageBuilder
Sep 21, 2018 @ 14:41:57

Tomas Vortuba has a new post on his site sharing information about one of the improvements that has been added to the Symplify, specifically in the PackageBuilder.

PackageBuilder was always sort of meta package with all the cool and shiny features anyone can use. After all, it's the most downloaded Symplify package hitting almost 1000 downloads a day.

In Symplify 5 now it allows you to drop manual binds from Symfony configs, separate files from directories in one method and merge nested YAML parameters with 1 service.

He lists out the three notable changes:

  1. Drop Manual Binds in Symfony configs
  2. Separate Files from Directories
  3. Merge Parameters without Leaving Any Behind

For each item in the list, he provides a link to the pull request that implemented it, a basic summary of the changes and code examples of what it enables.

tagged: symplify packagebuilder update feature top3 list

Link: https://www.tomasvotruba.cz/blog/2018/09/20/new-in-symplify-5-3-new-cool-features-of-package-builder/

Laravel News:
Laravel 5.7 Guest User Gates
Sep 06, 2018 @ 15:49:45

On the Laravel News site they highlight a change in the way that the "gates" handling works in the v5.7 release of the popular framework. In this change you can now allow "guest" users into certain parts of your system.

In Laravel 5.6 and below authorization gates and policies automatically return false for unauthenticated users. New in Laravel 5.7, you can now allow guests to go through authorization checks by using a nullable type-hint or setting the default value as null:

[...] By using a nullable type hint the $user variable will be null when a guest user is passed to the gate, and you can then make decisions about authorizing the action. If you allow nullable types and return true, then the guest will have authorization.

The post includes a code snippet showing how to put it to use and the resulting 403 page they would get otherwise. You can find out more about other new features of Laravel v5.7 in this other article.

tagged: laravel gate user tutorial nullable feature framework

Link: https://laravel-news.com/laravel-5-7-guest-user-gates-policies

Tomas Votruba:
9 Features of Symfony Plugin You Should Not Miss in Gifs
Aug 24, 2018 @ 21:17:54

In a new post to his site Tomas Votruba goes into a "deep dive" of the functionality that the Symfony plugin for PhpStorm provides and some of the functionality it provides.

After very successful PHP 7.3 diffs post, let's dive to gifs of Symfony Plugin. You might know them, but they might surprise you like they did surprise me. Let's go!

He then walks through the installation process and some of the features the plugin includes:

  • Enabling the plugin (via the PhpStorm configuration)
  • Faster Translation Autocreate (TWIG)
  • Autocomplete Translation Key (TWIG)
  • Instant Service Autocomplete in YAML (YAML)
  • Forget The Tag (YAML)
  • Jump from Href to Route (TWIG)
  • Instant Route in Controller (PHP)
  • Faster Queries in Doctrine Repository (PHP)
  • Template Autocomplete (PHP)

For each item in the list, there are animated gifs provided showing it in action. You can find out more about the plugin on the JetBrains site.

tagged: phpstorm symfony plugin feature list ide tutorial

Link: https://www.tomasvotruba.cz/blog/2018/08/23/9-features-of-symfony-plugin-you-should-not-miss-in-gifs/#6-jump-from-href-to-route-twig

Tomas Votruba:
What's New in PHP 7.3 in 30 Seconds in Diffs
Aug 17, 2018 @ 16:13:30

Tomas Vortuba has put together a post sharing a summary of what's new in PHP 7.3 using a bit different tactic than just descriptions: via diffs (in about 30 seconds).

No time but eager to hear PHP news? PHP 7.3 is out in December 2018 and it brings 173 changes. Which are the most useful ones?

For each item in his list he provides code snippets showing the change for:

  • Comma After the Last Argument
  • First and Last Array Key
  • Countable for Risky Variables
  • Safer JSON Parsing

Each item on the list also links over to the related RFC for the feature that provides more detail on the change.

tagged: php73 diff difference feature comma arraykey countable json tutorial

Link: https://www.tomasvotruba.cz/blog/2018/08/16/whats-new-in-php-73-in-30-seconds-in-diffs/

Matt Sparks:
I Want Scalar Objects in PHP
Jul 18, 2018 @ 19:16:09

Matt Sparks has an interesting post to his site sharing something he'd like to see in PHP 8 (quite a ways off in the future but still worth thinking about): scalar objects.

Recently, I read an interesting article from Andrew Carter entitled Make PHP Great Again [cheap plug: this link was included in my most recent Newsletter]. In it Andrew brought up the topic of scalar objects. If you’re not familiar with scalar objects, they represent a single value (integer, boolean, string, etc.) that you can perform operations on*.

He shares an example of what it might look like in PHP and his response to a tweet from Nikola Posa about what features they'd like to see. He then spends the remainder of the post making his case for the inclusion of scalar objects and how it can help clean up some of PHP's own naming and functional inconsistencies.

tagged: scalar object language feature opinion

Link: https://developmentmatt.com/i-want-scalar-objects-in-php/

Laravel News:
New Outer Array Functions Coming to PHP 7.3
Jul 18, 2018 @ 17:47:44

On the Laravel News site they've shown a spotlight on a new feature that's coming with the next major release of the PHP language (v7.3): outer array functions.

PHP 7.3 introduces two new array functions for working with the “outer” keys of an array. The RFC proposal included four new functions for both keys and values, but only the array key functions were accepted: array_key_first() and array_key_last().

[...] Although the outer array value functions were declined, at least new functions will be available for getting the outer keys of an array.

They then provide some code examples of this new functionality, showing how use these new functions to extract values. It also includes examples of the two functions - array_value_first and array_value_last - that were rejected from the RFC when voting happened.

tagged: array outer function php73 feature key value

Link: https://laravel-news.com/outer-array-functions-php-7-3

Sammy Kaye Powers:
Testing Unreleased Features of PHP
Jun 26, 2018 @ 14:31:52

In a new post to his site Sammy Kaye Powers shows you how to test unreleased features of PHP using a pull request related to a RFC that's officially been proposed.

We'll be discovering and testing a completely unreleased feature of php-src from an RFC that's still under discussion.

If you've ever wanted to be ahead of the curve of PHP features or you've just wanted to contribute back to PHP internals, testing an unreleased feature from an RFC is a fun and educational way to do so.

He uses the typed properties RFC in his example (allowing the addition of types to class properties). He then walks through the checkout of the PHP source, grabbing the pull request for the RFC and compiling PHP with the new code in place. He shows an example of a script that makes use of this new feature and tries it out. Finally, he covers how to run tests on this new version and some suggestions on adding typed properties to real-world projects.

tagged: language rfc pullrequest tutorial testing unreleased feature

Link: https://www.sammyk.me/how-to-compile-an-unreleased-rfc-feature-for-php-source-php-internals


Trending Topics: