PHP Core
✅ RFC: Asymmetric Visibility v2 💜
Thanks to Ilija Tovilo’s and Larry Garfield’s proposal, PHP 8.4 will have asymmetric visibility, i.e. possibility to make properties public for reading (get) and private for changing (set). The syntax was inspired by Swift.
✅ RFC: Lazy Objects 💜
Lazy objects are standard objects except that their initialization is deferred until one of their properties is accessed (including non-existing ones). This can be useful and it’s successfully implemented in PHP 8.4.
Very likely, the lazy objects won’t be used directly by most PHP users, but package and framework authors will benefit from it a lot as it allows them to remove a lot of boilerplate code. Here is for example how symfony/var-exporter will be simplified:
✅ RFC: Transform exit() from a language construct into a standard function 💜
Gina Peter Banyard proposed to make exit()
a proper function with the following signature:
function exit(string|int $status = 0): never {}
The benefit is that it will properly validate the arguments passed and throw a TypeError
if you pass something irrelevant, such as an array or resource.
📣 RFC: Improve language coherence for the behaviour of offsets and containers
PHP supports offset accesses using brackets []
with the following notation $container[$offset]
. However, the behavior of such accesses depends not only on the container type and offset, but also on the operation that is performed when accessing the offset. The existing behavior is highly inconsistent and difficult to predict.
Gina Peter Banyard proposes to improve language consistency for offsets and containers.
📣 RFC: Function Autoloading v4
Robert Landers proposes to add the ability to autoload functions by adding a 4th parameter to spl_autoload_register(…). Then with a simple PSR-4-like autoloader for functions, the code example could look like this:
spl_autoload_register(function ($function_name) {...}, false, false, SPL_AUTOLOAD_FUNCTION);
There is an alternative more comprehensive proposal from Gina P. Banyard: RFC: New core autoloading mechanism with support for function autoloading.
📣 RFC: Default expression
Paul Morris proposes to introduce the default
expression in argument-passing contexts to use the default value of the function or method.
function greetingEveryone($greeting = 'Hello', $subject = 'World') {
return sprintf('%s, %s!', $greeting, $subject);
}
echo greetingEveryone(default, ‘Earth’)); // Hello, Earth!
A similar proposal has been declined in the past, and it seems the problem has already been solved with the named arguments
PHP
📚 Handling large JSON payloads and extending the Request class
This article uses an approach that increases the memory limit when specific routes are targeted, and it's likely suited for apps that have a few routes that need to process larger files with a maximum of 50 MB (roughly speaking) or less.
📚 Understanding the final Keyword in PHP: Preventing Inheritance and Overriding
This article will explore how and when to use the final keyword, along with practical examples.
📚 Why I Avoid Using empty() in PHP? A Closer Look
One of the most useful yet widely misunderstood functions in PHP is empty(). At first glance, empty() seems like a handy shortcut for checking if a variable is, well, empty. However, its behavior goes beyond the obvious. According to the PHP documentation, empty() considers the following values as "empty".'
📚 Centralize your notification and job handling
To simplify sending multiple email notifications after various events (like user creation, password resets, etc.), you can take a few steps to centralize your notification and job handling. This approach will make your work easier and more scalable without having to create a separate job or notification for each event.
📚 PHP and Frontend Integration: Bridging the Gap for Dynamic Web Applications
I wanted to share with you some valuable insights on integrating PHP with frontend technologies to create dynamic and interactive web applications. Whether you're a seasoned developer or just starting, understanding how PHP works with HTML, CSS, and JavaScript can elevate your web development skills to new heights.
📚 Web Optimization with ETags: An Example with WordPress
I'm sure this has happened to you. You arrive at your workplace, turn on your computer, open your email, and after checking it, open a terminal and type: git pull. The terminal quickly responds: Already up-to-date..
📚 A Comprehensive Guide to Building a Basic CRUD Application Using PHP, HTML, CSS, and Vanilla JavaScript with XAMPP
In this tutorial, I will guide you step-by-step to create a basic CRUD application using PHP, HTML, CSS, Vanilla JavaScript, and MySQL.
📚 A Guide to LLM Retrieval-Augmented Generation with PHP
This article explains how Retrieval Augmented Generation (RAG) can assist in finding reliable information from source documents by including the best-matching documents as part of the prompt.
📚 Understanding PHP Metaprogramming: Dynamic Code Manipulation
PHP Metaprogramming refers to writing code that can generate or manipulate other code. In other words, it allows programs to have greater flexibility by enabling them to inspect, modify, or even generate new code at runtime.
📚 Understanding MySQL CPU Usage: Tools and Techniques
CPU usage in MySQL refers to the proportion of a computer's processor resources that the MySQL server utilizes to execute operations, including processing queries, managing database transactions, and maintaining the database system.
📚 PHP Magic Gone Wrong: Fixing the __FILE__ eval() Anomaly in Production
As a software developer, handling unexpected production issues is part of the job. But sometimes, the challenges we face require us to dig deeper into the core of the language we are working with, testing our knowledge of its nuances.
Laravel
📚 A New Era for Laravel: $57 Million Series A Funding with Accel – Here’s Why It’s a Game Changer!
Hold onto your hats, folks! Laravel just shook up the development world with some thrilling news—$57 million in Series A funding led by Accel. As a passionate Laravel user and fellow entrepreneur, this announcement is sending shockwaves across the PHP community, and I couldn't be more excited! So, let’s break down why this investment is monumental and why 2024 is gearing up to be the year of Laravel and PHP.
📚 Limit Eager Loaded Relationships on Laravel Models
Sometimes when you're eager loading relationships on Laravel models, you might want to limit the number of related models that are returned.
📚 The Power of Cache Tags in Laravel: 7 Reasons You Need Them Now
In this post, we’ll dive into Laravel Cache Tags, explaining why they are essential, how to implement them with examples, and most importantly — when and why you should use them to boost your Laravel application’s performance.
📚 Prepare your Laravel app for the cloud
In this article, we'll explore how to prepare your Laravel app for deployment in a cloud environment using FrankenPHP, Caddy, Dockerfiles, and finally deploying it to Sevalla.
📚 Laravel Password Hashing With Salt
This article can help you understand how secure your application is from this point of view or if it is necessary to make some changes in your PHP app to increase security.
📚 Sorting Rows with Empty Values at the Bottom and Non-Empty Values in Descending Order in Laravel
When working with databases, it's common to encounter situations where some fields might be empty or NULL. One challenge that often arises is how to sort records so that rows with empty fields appear at the bottom of the result set, while those with non-empty values are ordered in a meaningful way (e.g., descending order).
📚 Pest 3 is released!
We are excited to share that Pest 3 is now available! Get started with mutation testing today and level up your existing projects by finding untested code. Create consistent code with popular architecture presets, team management, a new configuration API, and more.
📚 Prezet: Markdown Blogging for Laravel
Prezet is a new Laravel Blogging app from Ben Bjurstrom that transforms markdown files into SEO-friendly blogs, articles, and documentation!
📚 Chaperone Eloquent Models in Laravel 11.22
The Laravel team released v11.22 this week, with the chaperone() Eloquent method for inverse relations, support for passing backed Enums to Queuable methods, the ability to pass backed Enums to route ->name() and ->domain() methods, and more.
📚 Understanding Laravel Middleware: A Deep Dive into Laravel 11's New Approach
In this article, we’ll dive deep into Laravel middleware, explaining what it is, why you should use it, and how to use it effectively. We will also look at the structure of middleware in Laravel 11, which has seen significant changes, including removing the HTTP Kernel.
📚 Unlocking the Power of Data Structures and Algorithms (DSA) in Laravel
Whether you're sorting data, handling complex tasks, or building background processes, understanding how DSA concepts fit into Laravel can give you an edge. Let’s dive into how some fundamental DSA concepts can be implemented in Laravel to optimize your apps.
📚 Laravel Sanctum vs. Passport: Choosing the Right Authentication for Your App
This blog explores the differences between Laravel Sanctum and Passport, their use cases, strengths, and weaknesses, helping you decide the right choice for your app.
📚 Simplifying View Logic with Laravel Blade’s Service Injection
Let’s explore how you can leverage this feature to write cleaner, more maintainable code.
Symfony
📚 Symfony S3 Service Encapsulation
Today, we’ll be integrating the Amazon S3 service into our Symfony project by utilizing the encapsulation method.