Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Class naming and the exp prefix

How to name PHP classes, files, functions, settings and tables in Exponential - your own prefix, exp for code contributed to the project, sevenx for 7x, why kernel eZ identifiers are never renamed, file names…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/php-developers/class-naming-and-the-exp-prefix.md

On this page

Class naming and the exp prefix

This page is for PHP developers who add classes, functions, settings or tables. Names in Exponential follow a few rules that keep thousands of classes from colliding in one class map, and that keep existing extensions working. The canonical statement is Naming prefixes: sevenx and exp.

Contents

  1. The rules in one table
  2. Your prefix
  3. exp and sevenx
  4. Kernel eZ identifiers stay
  5. Files and class names
  6. Namespaced classes
  7. Other identifiers

The rules in one table

You are writingPrefixExample
your own extension or project codeyour organization's or extension's prefixacmeReportService, acmereport
code you contribute to the Exponential projectexpexpHelpAudience, expContentSecurityPolicy
code 7x publishes as the companysevenx (or exp, as 7x decides)sevenx_dse, sevenx_valkey_cache
a change to an existing kernel classkeep its nameeZContentObject, eZINI, eZDB

Your prefix

All classes share one class map, so two classes with the same name in two extensions break each other: the generator warns about a duplicate, and one of them wins. Start every class, function, template operator, fetch function, setting block and table of your extension with a prefix that is yours: acmeReportService, acme_report (table), acmereport_total (operator), [AcmeReportSettings] (block).

exp and sevenx

  • exp is the project's prefix. New code in the kernel and in project extensions uses it: explayouts, expai, expqueue, expHelpAudience, the exp: console commands. Use exp only for code you contribute to the project.
  • sevenx is 7x's official public PHP code prefix; "7x" cannot be one, because a PHP identifier cannot start with a digit (class 7xFoo is a parse error).
  • Existing sevenx_* and exp* names are not renamed to make the prefixes look uniform; the folder name of an extension is its identity in settings.

Kernel eZ identifiers stay

eZContentObject, eZINI, eZDB, eZPersistentObject, ezpKernelWeb, the ez* file names, module names, template operators, settings and database tables are real identifiers. They are never renamed: renaming would break every extension and template written for them. eZ is the prefix of those identifiers, not the name of the product.

Two consequences for your code:

  • Do not create new classes with an eZ or ezp prefix; they look like kernel classes and may collide with future ones.
  • In comments, messages and documentation the product is Exponential. The old product name appears only as past history; a class name such as eZContentObject is not the product name and stays as it is.

Files and class names

ItemRuleExample
class fileone class per file, lower case file name of the class nameclasses/acmereportservice.php holds acmeReportService
datatype<datatypestring>type.php in datatypes/<datatypestring>/datatypes/acmecolor/acmecolortype.php
workflow event<typestring>type.php in eventtypes/event/<typestring>/eventtypes/event/acmenotify/acmenotifytype.php
moduledirectory name = module namemodules/acmereport/module.php
tests<Class>Test.phptests/acmeReportServiceTest.php

The class map generator finds classes by scanning files, so a class in a file of another name is found too; the rule is for people, who look for acmereportservice.php when they read acmeReportService.

Namespaced classes

The kernel uses namespaces only for the runnable classes (commands, cronjob parts, module views) and their services:

KindNamespace
kernel commandExponential\Command\Kernel\<Name>
extension commandExponential\Command\Extension\<Ext>\<Name>
extension cronjob partExponential\Cronjob\Extension\<Ext>\<Name>
extension module viewExponential\View\Extension\<Ext>\<Module>\<View>
kernel serviceExponential\Service\...

Everything else is global, prefixed class names (Module views as classes).

Other identifiers

  • INI files and blocks: your own file (acmereport.ini) with your own blocks; changes to kernel files go into *.ini.append.php of your extension.
  • Tables: acme_*, lower case, unquoted names that work on every supported database (Code for every supported database).
  • Template operators and fetch functions: prefixed (acmereport_money, fetch( 'acmereport', 'items' )).
  • Translation contexts: extension/acmereport.
  • CSS classes and JavaScript globals: your prefix as well.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x