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

Autoloads and class naming

How Exponential finds your classes - the generated autoload arrays, when to regenerate them, naming new classes with the exp prefix, namespaced runnable classes, Composer autoloading, and the errors a stale autoload…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/creators/app-creators/autoloads-and-class-naming.md

On this page

Autoloads and class naming

This page is for application creators who add PHP classes. Exponential finds classes through generated class maps; a class that is not in the map does not exist as far as the application is concerned.

Contents

  1. The class maps
  2. Regenerating
  3. Naming
  4. Namespaced classes
  5. Composer libraries
  6. When a class is not found

The class maps

MapCoversMade by
autoload/ezp_kernel.phpkernel classesshipped; regenerated by kernel developers
autoload/ezp_extension.phpclasses of every extensionphp bin/php/ezpgenerateautoloads.php -e
Composer's autoloadervendor/ librariescomposer install

The generator scans the extension directories (including AdditionalExtensionDirectories[]) for PHP files and lists each class with its file (10.7 Class autoloads).

Regenerating

php bin/php/ezpgenerateautoloads.php -e

Run it after adding, renaming or moving a class. Under Velocity, workers keep the map they started with: restart them (exp:velocity deploy regenerates and restarts in order). A new class that settings name (a handler, a datatype) must be deployed before the setting that uses it goes live.

Naming

  • New classes start with a prefix of your organization or your extension: acmeDemoList, acmeDemoListService. sevenx and exp are the prefixes of 7x and the Exponential project: sevenx is 7x's official public PHP code prefix (a class name cannot start with a digit, so "7x" cannot be one), and 7x uses exp with intent for work it assigns to the Exponential project and the Exponential Foundation. Use exp only for code you contribute to the project. See Naming prefixes: sevenx and exp.
  • One class per file; file name in lower case: classes/acmedemolist.php.
  • Never reuse a kernel name (eZ...) for a new class; never rename an existing kernel identifier.

See Layering and naming and Coding standards.

Namespaced classes

Runnable classes (commands, cronjob parts, module views) use namespaces: Exponential\Command\Extension\<Ext>\<Name>, Exponential\Cronjob\Extension\<Ext>\<Name>, Exponential\View\Extension\<Ext>\<Module>\<View>, in extension/<ext>/classes/runnable/... (Commands, cronjob parts and module views as classes). The generator maps them like any class.

Composer libraries

An extension that needs a library declares it in its own composer.json; the installation's Composer installs it into vendor/. Do not ship vendor/ inside the extension (Composer packages and Packagist).

When a class is not found

SymptomCauseFix
Class "expDemoList" not foundmap not regeneratedezpgenerateautoloads.php -e
Works under Apache, fails under Velocityworkers started before the class existedexp:velocity restart
A setting names a class and the site breaksthe class was deployed after the settingdeploy code first; guard with class_exists() where a missing class must not break pages
The generator warns about a duplicatetwo files declare the same classrename one

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