Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 39 and 401]

(no description)

File Size: 148 lines (5 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Psr4Autoloader:: (5 methods):
  register()
  addNamespace()
  loadClass()
  loadMappedFile()
  requireFile()


Class: Psr4Autoloader  - X-Ref

Class Psr4Autoloader

register()   X-Ref
Register loader with SPL autoloader stack.

return: void

addNamespace($prefix, $baseDir, $prepend = false)   X-Ref
Adds a base directory for a namespace prefix.

param: string $prefix The namespace prefix.
param: string $baseDir A base directory for class files in the
param: bool $prepend If true, prepend the base directory to the stack
return: void

loadClass($class)   X-Ref
Loads the class file for a given class name.

param: string $class The fully-qualified class name.
return: mixed The mapped file name on success, or boolean false on

loadMappedFile($prefix, $relativeClass)   X-Ref
Load the mapped file for a namespace prefix and relative class.

param: string $prefix The namespace prefix.
param: string $relativeClass The relative class name.
return: mixed Boolean false if no mapped file can be loaded, or the

requireFile($file)   X-Ref
If a file exists, require it from the file system.

param: string $file The file to require.
return: bool True if the file exists, false if not.