# Create the Build to Prefix the Joomla Module

PHP-Prefixer works based on Composer (opens new window) as the dependency management tool. It allows you to declare the libraries your project depends on and manages (install/updates) them for you. For more information about Composer, please, visit https://getcomposer.org/ (opens new window).

# Prefixing the "Hello Prefixed World module" Project

In this guide, we will prefix the project "Hello Prefixed World Module". We will prefix it with our prefix PPP.

The source code of the project can be found in this repository: https://github.com/PHP-Prefixer/hello-joomla-world (opens new window)

The results of the prefixing process can be found in this repository: https://github.com/PHP-Prefixer/hello-joomla-world_prefixed (opens new window)

# The "Hello Prefixed World Module" Project

The modified version of the Hello World module shows a formatted date before the "Hello, World!" message src\Helper.php:


 * @package Hello Prefixed World for Joomla
 * @version 1.0.0

namespace ModHelloWorld;

// No direct access
defined('_JEXEC') or die;

use Carbon\Carbon;

class Helper
     * Retrieves the hello message
     * @param   array  $params An object containing the module parameters
     * @access public
    public static function getHello($params)
        $now = Carbon::now();
        $formattedDate = $now->toDateTimeString();

        return $formattedDate.' / Hello, World!';

# The PHP-Prefixer Configuration

In the composer.json schema, in the extra configuration, the PHP-Prefixer configuration is as follows:

    "extra": {
        "php-prefixer": {
            "project-name": "Hello Prefixed World for Joomla",
            "namespaces-prefix":: "PPP",
            "global-scope-prefix": "PPP_",

            "exclude-paths": [

The configuration declares the project name and the prefix PPP used for namespaces and global objects (functions, etc.).

In particular, this schema has the attribute excludePaths to help package the module for distribution. The excludePaths remove folders that should not be included in the target prefixed module (commands, unit tests, library documentation, etc.).

# Verify Composer.json

To review the project:

  1. Download the source code from the repository.
  2. Go to the project directory.
  3. Run the following command to verify the schema and lock the project's dependencies that would be distributed:
~$ composer update --no-dev
Writing lock file
Generating autoload files

Then, compress the files into a new ZIP file or download the project's ZIP file from GitHub.

# Create a Build

You can now set up a new build and prefix the project in the "Dashboard/ Projects" area in a matter of minutes. Follow the steps below to set up a build and prefix the project ZIP file.

  1. Go to "Project."
  2. Click on "Create Build."
  3. Select the file to be prefixed.
  4. Upload and create the build; click on "Create Build."

Create a Build

# Validating the Build

Once the build is created, the PHP-Prefixer service automatically validates the project and continues with the next steps.

Validating the Build

# Prefixing the Build

Once the build is validated, the PHP-Prefixer service prefixes the files and notifies when processing is completed.

Prefixing the Build

Congratulations, you’ve prefixed your "Hello Prefixed World Module" for the Joomla project!