How the PHP community add features to the language itself
Tags: php, opensource, webdev, programming
Published: 2023-06-02 09:11:31

Have you ever wondered how a language sets about adding new features, or deciding what changes from version to version?

I've been a long time (>10 years!) contributor to the PHP project, making regular contributions to various internal projects, documentation, moderating comments, bugs, and tons more.

The PHP project as a whole operates a karma system. There are dozens of sub-projects, so someone with access to help moderate the [bug tracker](https://bugs.php.net/) doesn't necessarily have access to update the [docs](https://www.php.net/docs.php). It's a system that works well and has been in place for as long as I have been involved.

## RFCs

The PHP language evolves through a consensus-building process where new features, deprecations, and changes are proposed, discussed, and approved. Central to this process is the Request for Comments (RFC) procedure, a democratic mechanism enabling contributors to suggest improvements and collectively decide on PHP's future direction.

### What is an RFC?

RFC stands for Request for Comments. In the context of PHP, an RFC is a formal document proposing a change to the language. This change could be the addition of a new feature, a modification to an existing feature, or a proposal to remove a particular aspect of the language.

### The RFC Process

The RFC process consists of several steps, designed to ensure each proposal is thoroughly vetted and that all interested parties have a chance to provide input.

#### 1. Idea Generation and Discussion

Anyone can come up with an idea for improving PHP, but making it into an RFC usually requires discussion and refinement. This typically occurs on the PHP internals mailing list or other communication channels, where developers share their ideas and receive initial feedback.

#### 2. Writing the RFC

The proposer, often with help from others, writes a formal RFC document detailing the proposal. The RFC includes a rationale for the proposed change, a detailed explanation of the change itself, any potential backward compatibility issues, and other relevant details. If the proposal involves a technical change to PHP's codebase, the RFC may also include patches or prototypes illustrating the change.

#### 3. Posting the RFC for Discussion

Once the RFC is ready, it's published on the PHP Wiki under the RFC section. There, it's open to discussion by anyone interested - not just those who can vote. This discussion period is a critical opportunity for the community to debate the proposal's merits, identify potential issues, and suggest improvements. Depending on the feedback, the proposer may revise the RFC during this stage.

#### 4. Voting

After a suitable discussion period, usually two weeks, a vote is held on whether to accept the RFC. Only PHP internals contributors (those who have contributed to the PHP source code in the past) are eligible to vote. An RFC needs a 2/3 majority to pass if it proposes a language change. In contrast, a simple 50%+1 majority suffices for other types of changes.

#### 5. Implementation

If the RFC passes, the proposed changes are integrated into the PHP source code. The proposer often does this, but other contributors can also do the implementation. Once the changes are implemented and tested, they're merged into the PHP source code repository, and the feature becomes part of the next PHP release.

## My involvement

The PHP language is extremely broad and feature-rich. There are functions and features that many people don't know exist, and some quite niche parts of the language that focus on a specific subset of features.

As a personal choice, I only ever vote on an RFC that directly effects me and the work I do. I feel that as a developer who uses the language every day, I am best placed to make an informed decision on features that I use, rather than those I have never touched. I'll leave those more qualified than me to vote on those.

## Example RFCs

Below are a few of the most popular RFCs that have been implemented over the years. 

- [RFC to skip version 6 and go to version 7](https://wiki.php.net/rfc/php6)
- [Deprecations in PHP 8.3](https://wiki.php.net/rfc/deprecations_php_8_3)
- [PHP 7.0 timeline](https://wiki.php.net/rfc/php7timeline)
- [PHP Generics](https://wiki.php.net/rfc/generics)

If you're interested in contributing to the PHP project then there are plenty of ways to [get involved](https://www.php.net/get-involved).

If you feel like you know PHP pretty well, then you should also check out our [PHP Certification](https://accreditly.io/certifications/php-fundamentals).