PHP Annotated – July 2019
Greetings everyone,
In our July’s edition of PHP Annotated, you can read about the latest on the PHP 7.4.0 alpha 3 release, ReactPHP 1.0 LTS, new proposals from PHP Internals, such as the Strict operators directive, as well as links for Laravel and Symfony, useful tools, videos, and a whole lot more!
⚡️ News & Releases
- PHP 7.3.7
- PHP 7.2.20
- PHP 7.4.0 alpha 3 – The last planned alpha release. The full list of new features and all the changes to the branch are available in the UPGRADING doc. See the overviews: What’s new in PHP 7.4, What’s New in PHP 7.4 (Features, Deprecations, Speed). The feature-freeze is expected July 22, so the list of changes may be extended only with those that are in voting right now:
• Deprecations for PHP 7.4
• Escape PDO “?” parameter placeholder
• Deprecate curly brace syntax for accessing array elements and string offsets
• Add str_starts_with(), str_ends_with() and related functions.Also, there were couple interesting changes made without RFC:
• proc_open will execute programs without going through a shell:proc_open(['php', '-r', 'echo "Hello World\n";'], $descriptors, $pipes);
. So there is no need to take care of argument escaping and signals will be correctly delivered to the process.
• PHP 7.4 will throw a notice for invalid array accesses like$null[0]
or$int['foo']
. Previously this silently returnednull
:$null = null; var_dump($null[0]); // NULL $int = 42; var_dump($int['foo']); // NULL var_dump(true[0] === false[0]); // true
🐘 PHP Internals
- [RFC] Normalize arrays’ “auto-increment” value on copy on write – This RFC proposes to reset the “autoincrement” value when an array is being copied-on-write. As if a new empty array was created and then filled up entry-by-entry from the old one.
$array = [0, 1, 2, 3]; unset($array[3], $array[2]); $arrayCopy = $array; $arrayCopy[] = 2; // If the proposal is accepted, the following statement will be true. // Currently, the arrays below are not equivalent. assert($arrayCopy === [0, 1, 2]);
- [RFC] Strict operators directive – PHP performs implicit type casting for most operators. The rules of conversion are complex and may lead to surprising results. This RFC proposes to introduce a new directive
strict_operators
, which will limit type conversions and make them throwTypeError
for incompatible operands. The document describes in detail the current and proposed behaviors and has many examples. So far, it has been postponed until PHP 8.0, as the change is too big for 7.4. . - 🔈 PHP Internals News #17: – With Theodore Brown and Bishop Bettini about Numeric Literal Separator.
- 🔈 PHP Internals News #18: – With Arnold Daniels about the Strict Operator Directive.
🛠 Tools
- cycle/orm – A powerful ORM designed specifically for long-running PHP apps. Full documentation is ready, with an example of dynamic schema and relations.
- SerafimArts/pipe – An object-oriented pipe operator implementation for function call chains.
- helhum/dotenv-connector – A Composer plugin that makes values from a .env file available as environment variables.
- thephpleague/commonmark – A markdown parser. Overview of the 1.0 release.
- sebastianfeldmann/phpbu – A database and file backups utility that can encrypt and send backups to cloud storages.
- localheinz/http-method – A constants for HTTP request methods.
- leocarmo/circuit-breaker-php – A Circuit Breaker pattern implementation for PHP. As an alternative also see ackintosh/ganesha.
Symfony
- Symfony Local Web Server, 6 months later
- New Symfony Core Team Member: Yonel Ceruto.
- Improvements for Twig: Better White Space Control, Simpler Macros, Filter, Map and Reduce Features.
- Efficient testing with fixtures on Symfony 4
- Migrating Symfony Project to Kubernetes
Laravel
- Improving assertions on Laravel fakes
- A dive into Laravel’s TestCase to decrease the Kernel boot time by ~50% during a test suite run.
- 🎥 Laravel Core Adventures – Accessors & Mutators
- 🔈 Taylor’s Laravel Snippet #14 podcast – Laravel Live UK, whereHasMorph, laravel/ui, front-end authorization, performance, and Lumen.
- 🎥 Event Sourcing with Laravel and EventSauce
🌀 Async PHP
- ReactPHP 1.0 LTS – It’s 7 years since the first ReactPHP v0.1.0 release. Now the team has announced releases of 1.0 versions for reactphp/dns, reactphp/cache packages, and reactphp/react meta-package. It means that all the main components in ReactPHP are now stable. The release with LTS marks that they will be supported for at least the next 2 years.
- 🎥 Creating a RESTful API with ReactPHP: Plans and First Steps, What is a RESTful API?, Adding routes, Refactoring to controllers, Dummy endpoints, Workflow improvements
- Using ReactPHP to run Drupal tasks
- swoft-cloud/swoft 2.0 – A framework based on Swoole for developing microservices, inspired by Spring Cloud. Implements PSR-7, PSR-14, PSR-15, and leverages AOP. See a short introductory post.
🚨 Security
- nbs-system/snuffleupagus – The extension blocks potentially harmful code execution in runtime. Read more about using it agoinst recent high-profile vulnerabilities.
- Abusing PHP query string parser to bypass IDS, IPS, and WAF.
- Magento 2.3.1: Unauthenticated Stored XSS to RCE.
💡 Misc
- Clean Code concepts adapted for PHP.
- Null Hell and How to Get Out of It
- Stop using DateTime
- You may not need a query bus
- Mutation testing – we are testing tests
- A decent PHP Wishlist
- Intro Guide to Dockerfile Best Practices
📺 Audio/Video
- 🎥 PHP fwdays’19, Kyiv (English talks only)
- 🎥 Dutch PHP Conference 2019, Amsterdam
- 🎥 PHPDay 2019, Verona
- 🎥 PHP Town Hall Episode 67 – On Zend Framework 3 and Laminas with Adam Culp.
- 🔈 php[arch] podcast #21: Serverless PHP, Array Functions, and Data Structures.
- 🔈 That Podcast Episode 60 – On Twig, Drupal, and Sculpin with Oliver Davies.
- 🔈 That Podcast Episode 61 – On a new Symfony’s HTTP Client component with Nicolas Grekas.
Thanks for reading!
If you have any interesting or useful links to share via PHP Annotated, leave a comment or drop me a message on Twitter.
Your JetBrains PhpStorm Team
The Drive to Develop