PHPnews.io

Overview for 'stitcher-io'

A letter to the PHP team

Written by Stitcher.io / Original link on Aug. 27, 2019

To whomever contributes to PHP, from a userland developer. Let me start by thanking those who actively work on the PHP project. Those who contribute to the core, extensions, maintain the docs or vote on RFCs: thank you for a language that I can use every day both in my professional and personal lif…


Things dependency injection is not about

Written by Stitcher.io / Original link on Jul. 29, 2019

If you're using any modern framework, chances are you're heavily relying on dependency injection. But do you know what dependency injection actually is about — or better: what it's not? # The dependency container While every modern framework ships with a dependency container — a big box that knows…


Preloading in PHP 7.4

Written by Stitcher.io / Original link on Jul. 4, 2019

With PHP 7.4, support for preloading was added, a feature that could improve the performance of your code significantly. In a nutshell, this is how it works: In order to preload files, you need to write a custom PHP script This script is executed once on server startup All preloaded files are avail…


Typed properties in PHP 7.4

Written by Stitcher.io / Original link on Jun. 29, 2019

Typed class properties have been added in PHP 7.4 and provide a major improvement to PHP's type system. These changes are fully opt-in and non breaking to previous versions. In this post we'll look at the feature in-depth, but first let's start by summarising the most important points: They are ava…


Tests and types

Written by Stitcher.io / Original link on Jun. 6, 2019

Imagine a simple function: rgbToHex. It takes three arguments, integers between 0 and 255; and converts it to a hexadecimal string. Here's what this function's definition might look like in a dynamic, weakly typed language: rgbToHex(red, green, blue) { // … } I think we all agree that "program corr…


Arrow functions in PHP 7.4

Written by Stitcher.io / Original link on May. 1, 2019

Short closures, also called arrow functions, are a way of writing shorter functions in PHP. This notation is useful when passing closures to functions like array_map or array_filter. This is what they look like: // A collection of Post objects $posts = [/* … */]; $ids = array_map(fn($post) => $p…