Module
class Module implements Serializable (View source)
Abstraction of a PHP Package. Can be used to retrieve information about Silverstripe CMS modules, and other packages
managed via composer, by reading their composer.json file.
Constants
| deprecated TRIM_CHARS | 
                     
  | 
            
| deprecated CI_PHPUNIT_NINE | 
                     Return value of getCIConfig() when module uses PHPUNit 9  | 
            
| deprecated CI_PHPUNIT_FIVE | 
                     Return value of getCIConfig() when module uses PHPUNit 5  | 
            
| deprecated CI_UNKNOWN | 
                     Return value of getCIConfig() when module does not use any CI  | 
            
Properties
| protected | string | $path | Full directory path to this module with no trailing slash  | 
                |
| protected | string | $basePath | Base folder of application with no trailing slash  | 
                |
| protected | array | $composerData | Cache of composer data  | 
                |
| protected | ModuleResource[] | $resources | Loaded resources for this module  | 
                
Methods
Gets name of this module. Used as unique key and identifier for this module.
Get full composer name. Will be null if no composer.json is available
Gets "short" name of this module. This is the base directory this module is installed in.
Name of the resource directory where vendor resources should be exposed as defined by the extra.resources-dir
key in the composer file. A blank string will be returned if the key is undefined.
The __unserialize() magic method will be automatically used instead of this almost all the time This method will be automatically used if existing serialized data was not saved as an associative array and the PHP version used in less than PHP 9.0
Details
        
                            
    __construct(string $path, string $basePath)
        
    
    Construct a module
        
                            string
    getName()
        
    
    Gets name of this module. Used as unique key and identifier for this module.
If installed by composer, this will be the full composer name (vendor/name).
If not installed by composer this will default to the basedir()
        
                            string|null
    getComposerName()
        
    
    Get full composer name. Will be null if no composer.json is available
        
                            array
    getExposedFolders()
        
    
    Get list of folders that need to be made available
        
                            string
    getShortName()
        
    
    Gets "short" name of this module. This is the base directory this module is installed in.
If installed in root, this will be generated from the composer name instead
        
                            string
    getResourcesDir()
        
    
    Name of the resource directory where vendor resources should be exposed as defined by the extra.resources-dir
key in the composer file. A blank string will be returned if the key is undefined.
Only applicable when reading the composer file for the main project.
        
                            string
    getPath()
        
    
    Get base path for this module
        
                            string
    getRelativePath()
        
    
    Get path relative to base dir.
If module path is base this will be empty string
        
                            array
    __serialize()
        
    
    No description
        
                            void
    __unserialize(array $data)
        
    
    No description
        
                            string
    serialize()
        deprecated
    
    deprecated
The __serialize() magic method will be automatically used instead of this
        
                            
    unserialize(string $serialized)
        deprecated
    
    deprecated
The __unserialize() magic method will be automatically used instead of this almost all the time This method will be automatically used if existing serialized data was not saved as an associative array and the PHP version used in less than PHP 9.0
        
                            
    activate()
        
    
    Activate _config.php for this module, if one exists
        
                    protected        
    loadComposer()
        
    
    No description
        
                            ModuleResource
    getResource(string $path)
        
    
    Get resource for this module
        
                            string
    getRelativeResourcePath(string $path)
        deprecated
    
    deprecated
No description
        
                            string
    getResourcePath(string $path)
        deprecated
    
    deprecated
No description
        
                            string
    getResourceURL(string $path)
        deprecated
    
    deprecated
No description
        
                            string
    hasResource(string $path)
        deprecated
    
    deprecated
No description