Welcome to PHP-Prefixer

PHP-Prefixer is a new and innovative service to apply prefixes to PHP libraries and projects. The main objective is adding a namespace or a prefix to the .PHP files.

Let’s understand it using an example.

This is a sample snippet of code using the Carbon library, an API extension for DateTime that supports 281 different languages:

namespace Carbon;

use Carbon\Exceptions\InvalidDateException;
use DateInterval;
use Symfony\Component\Translation;

class Carbon extends DateTime
{
    const NO_ZERO_DIFF = 01;
...

You want to add our company prefix “ACME” to the library and the project. After processing the source code, the output build results in the following snippet of code:

namespace ACME\Carbon;

use ACME\Carbon\Exceptions\InvalidDateException;
use DateInterval;
use ACME\Symfony\Component\Translation;

class Carbon extends DateTime
{
    const NO_ZERO_DIFF = 01;
...

As you can see, the prefixer service adds the ACME namespace to the Carbon namespace and the associated dependencies (the Symfony library).

We are currently working in a closed Beta environment and planning to launch the service to the public in October 2020. 

Excited?

Watch this space for more news!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.