# Background

# What is PHP-Prefixer?

PHP-Prefixer is a service to apply PHP prefixes to namespaces, functions, helpers, traits, interfaces, etc. You start with a Composer project and a set of dependencies and prefix all library files at once to generate a consistent prefixed codebase.

PHP-Prefixer abstracts the complexity of manually applying prefixes to PHP files. The service automates and streamlines the process of prefixing while providing the scalability and simplicity of serverless computing.

PHP-Prefixer is a rule-based expert system that processes the project and dependencies iteratively to prefix every project file.

Here is a sample class declaration:

namespace ACME\Carbon;

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

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

The associated prefixed class declaration, with a new and distinct namespace ACME:

namespace ACME\Carbon;

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

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

# Using Composer Libraries in the Cloud

Composer (opens new window) is a dependency management tool in PHP. It allows you to declare the libraries your project depends on and manages (install/update) them for you. Working in tandem with Composer, Packagist (opens new window) is the central Composer repository. It aggregates public PHP packages installable with Composer.

Composer was initially designed to work as a standalone tool for developers working separately. The coordination of the usage of libraries is a case that must be solved via other means.

The prefixing of PHP is a practical solution that can help to sort out the use case. PHP-Prefixer is an automated online service, powered by a complex rule-based system that implements the prefixing of Composer dependencies. The service is a cloud computing processing system, offering on-demand resources to process general PHP packages. The service doesn’t need to be installed on each user’s computer, can be accessed from different locations, and doesn’t require the complex configurations of software or hardware.

Last Updated: 12/19/2023, 9:07:55 AM