reference appendices

Userland Naming Guide

PHP documents naming guidance for userland code so packages avoid collisions with future language additions. Names should also communicate domain purpose and follow the project’s established convention.

Use This Reference When

  • Publishing reusable package symbols.
  • Designing global functions or constants.
  • Reviewing names that resemble reserved or core identifiers.

Namespaced Package Code

PHP example
<?php

namespace Acme\Catalog;

final class ProductImporter {}

$importer = new ProductImporter();
echo $importer::class . PHP_EOL;

// Prints:
// Acme\Catalog\ProductImporter

Namespaces reduce collision risk, but they do not replace clear naming. Avoid leading double underscores for userland symbols because PHP reserves that style for magic behaviour.

Practice

Review Public Symbols

List five public symbols from a small package and check namespace, clarity, and collision risk.

Show solution

Record any global function, global constant, magic-looking name, or vague class name that should be replaced before publishing.