PHP Class Puli\Manager\Api\Container

Use this class to access the managers provided by this module: php $puli = new Puli(getcwd()); $puli->start(); $moduleManager = $puli->getModuleManager(); The Puli class either operates in the global or a project context: * The "global context" is not tied to a specific root module. A global context only loads the settings of the "config.json" file in the home directory. The Puli class operates in the global context if no project root directory is passed to the constructor. In the global context, only the global config file manager is available. * The "project context" is tied to a specific Puli project. You need to pass the path to the project's root directory to the constructor or to {@link setRootDirectory()}. The configuration of the "puli.json" file in the root directory is used to configure the managers. The Puli class creates four kinds of managers: * The "config file manager" allows you to modify entries of the "config.json" file in the home directory. * The "module file manager" manages modifications to the "puli.json" file of a Puli project. * The "module manager" manages the module repository of a Puli project. * The "repository manager" manages the resource repository of a Puli project. * The "discovery manager" manages the resource discovery of a Puli project. The home directory is read from the context variable "PULI_HOME". If this variable is not set, the home directory defaults to: * $HOME/.puli on Linux, where $HOME is the context variable "HOME". * $APPDATA/Puli on Windows, where $APPDATA is the context variable "APPDATA". If none of these variables can be found, an exception is thrown. A .htaccess file is put into the home directory to protect it from web access.
Since: 1.0
Author: Bernhard Schussek ([email protected])
Afficher le fichier Open project: puli/manager Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( string | null $rootDir = null, string $env = Environment::DEV ) Creates a new instance for the given Puli project.
arePluginsEnabled ( ) : boolean Returns whether Puli plugins are enabled.
disablePlugins ( ) Disables all Puli plugins.
enablePlugins ( ) Enables all Puli plugins.
getAssetManager ( ) : Puli\Manager\Api\Asset\AssetManager Returns the asset manager.
getConfigFileConverter ( ) : Puli\Manager\Config\ConfigFileConverter Returns the configuration file serializer.
getConfigFileManager ( ) : Puli\Manager\Api\Config\ConfigFileManager Returns the configuration file manager.
getContext ( ) : Puli\Manager\Api\Context\Context | Puli\Manager\Api\Context\ProjectContext Returns the context.
getDiscovery ( ) : Puli\Discovery\Api\EditableDiscovery Returns the resource discovery of the project.
getDiscoveryManager ( ) : Puli\Manager\Api\Discovery\DiscoveryManager Returns the resource discovery manager.
getEnvironment ( ) : string Retturns the environment of the managed Puli project.
getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface | null Returns the used event dispatcher.
getFactory ( ) : object
getFactoryManager ( ) : Puli\Manager\Api\Factory\FactoryManager
getInstallationManager ( ) : Puli\Manager\Api\Installation\InstallationManager Returns the installation manager.
getInstallerManager ( ) : Puli\Manager\Api\Installer\InstallerManager Returns the installer manager.
getJsonDecoder ( ) : JsonDecoder Returns the JSON decoder.
getJsonEncoder ( ) : JsonEncoder Returns the JSON encoder.
getJsonValidator ( ) : JsonValidator Returns the JSON validator.
getLegacyModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter Returns the module file serializer with support for legacy versions.
getLegacyRootModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter Returns the module file serializer with support for legacy versions.
getLogger ( ) : Psr\Log\LoggerInterface Returns the logger.
getModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter Returns the module file converter.
getModuleManager ( ) : Puli\Manager\Api\Module\ModuleManager Returns the module manager.
getRepository ( ) : Puli\Repository\Api\EditableRepository Returns the resource repository of the project.
getRepositoryManager ( ) : Puli\Manager\Api\Repository\RepositoryManager Returns the resource repository manager.
getRootDirectory ( ) : string | null Returns the root directory of the managed Puli project.
getRootModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter Returns the module file converter.
getRootModuleFileManager ( ) : Puli\Manager\Api\Module\RootModuleFileManager Returns the root module file manager.
getServerManager ( ) : Puli\Manager\Api\Server\ServerManager Returns the server manager.
getStorage ( ) : Puli\Manager\Api\Storage\Storage Returns the file storage.
getUrlGenerator ( ) : Puli\UrlGenerator\Api\UrlGenerator Returns the resource URL generator.
isStarted ( ) : boolean Returns whether the service container is started.
setEnvironment ( string $env ) Sets the environment of the managed Puli project.
setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher ) Sets the event dispatcher to use.
setLogger ( Psr\Log\LoggerInterface $logger ) Sets the logger to use.
setRootDirectory ( string | null $rootDir ) Sets the root directory of the managed Puli project.
start ( ) Starts the service container.

Private Methods

Méthode Description
activatePlugins ( )
createGlobalContext ( )
createProjectContext ( string $rootDir, $env ) : Puli\Manager\Api\Context\ProjectContext Creates the context of a Puli project.
createValidatingConverter ( Webmozart\Json\Conversion\JsonConverter $innerConverter, string | callable | null $schema = null ) : ValidatingConverter Decorates a converter with a {@link ValidatingConverter}.
getJsonStorage ( ) : JsonStorage Returns the JSON file storage.
getJsonVersioner ( ) : Webmozart\Json\Versioning\JsonVersioner Returns the JSON versioner.
getModuleFileMigrationManager ( ) : MigrationManager Returns the migration manager for module files.
loadConfigFile ( $homeDir, Puli\Manager\Api\Config\Config $baseConfig )
parseHomeDirectory ( ) : null | string Parses the system context for a home directory.
validatePluginClass ( string $pluginClass ) Validates the given plugin class name.

Method Details

__construct() public méthode

Creates a new instance for the given Puli project.
public __construct ( string | null $rootDir = null, string $env = Environment::DEV )
$rootDir string | null The root directory of the Puli project. If none is passed, the object operates in the global context. You can set or switch the root directories later on by calling {@link setRootDirectory()}.
$env string One of the {@link Environment} constants.

arePluginsEnabled() public méthode

Returns whether Puli plugins are enabled.
public arePluginsEnabled ( ) : boolean
Résultat boolean Returns `true` if Puli plugins will be loaded and `false` otherwise.

disablePlugins() public méthode

Disables all Puli plugins.
public disablePlugins ( )

enablePlugins() public méthode

Enables all Puli plugins.
public enablePlugins ( )

getAssetManager() public méthode

Returns the asset manager.
public getAssetManager ( ) : Puli\Manager\Api\Asset\AssetManager
Résultat Puli\Manager\Api\Asset\AssetManager The asset manager.

getConfigFileConverter() public méthode

Returns the configuration file serializer.
public getConfigFileConverter ( ) : Puli\Manager\Config\ConfigFileConverter
Résultat Puli\Manager\Config\ConfigFileConverter The configuration file serializer.

getConfigFileManager() public méthode

Returns the configuration file manager.
public getConfigFileManager ( ) : Puli\Manager\Api\Config\ConfigFileManager
Résultat Puli\Manager\Api\Config\ConfigFileManager The configuration file manager.

getContext() public méthode

Returns the context.
public getContext ( ) : Puli\Manager\Api\Context\Context | Puli\Manager\Api\Context\ProjectContext
Résultat Puli\Manager\Api\Context\Context | Puli\Manager\Api\Context\ProjectContext The context.

getDiscovery() public méthode

Returns the resource discovery of the project.
public getDiscovery ( ) : Puli\Discovery\Api\EditableDiscovery
Résultat Puli\Discovery\Api\EditableDiscovery The resource discovery.

getDiscoveryManager() public méthode

Returns the resource discovery manager.
public getDiscoveryManager ( ) : Puli\Manager\Api\Discovery\DiscoveryManager
Résultat Puli\Manager\Api\Discovery\DiscoveryManager The discovery manager.

getEnvironment() public méthode

Retturns the environment of the managed Puli project.
public getEnvironment ( ) : string
Résultat string One of the {@link Environment} constants.

getEventDispatcher() public méthode

Returns the used event dispatcher.
public getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface | null
Résultat Symfony\Component\EventDispatcher\EventDispatcherInterface | null The used logger.

getFactory() public méthode

public getFactory ( ) : object
Résultat object

getFactoryManager() public méthode

public getFactoryManager ( ) : Puli\Manager\Api\Factory\FactoryManager
Résultat Puli\Manager\Api\Factory\FactoryManager

getInstallationManager() public méthode

Returns the installation manager.
public getInstallationManager ( ) : Puli\Manager\Api\Installation\InstallationManager
Résultat Puli\Manager\Api\Installation\InstallationManager The installation manager.

getInstallerManager() public méthode

Returns the installer manager.
public getInstallerManager ( ) : Puli\Manager\Api\Installer\InstallerManager
Résultat Puli\Manager\Api\Installer\InstallerManager The installer manager.

getJsonDecoder() public méthode

Returns the JSON decoder.
public getJsonDecoder ( ) : JsonDecoder
Résultat Webmozart\Json\JsonDecoder The JSON decoder.

getJsonEncoder() public méthode

Returns the JSON encoder.
public getJsonEncoder ( ) : JsonEncoder
Résultat Webmozart\Json\JsonEncoder The JSON encoder.

getJsonValidator() public méthode

Returns the JSON validator.
public getJsonValidator ( ) : JsonValidator
Résultat Webmozart\Json\JsonValidator The JSON validator.

getLegacyModuleFileConverter() public méthode

Returns the module file serializer with support for legacy versions.
public getLegacyModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter
Résultat Webmozart\Json\Conversion\JsonConverter The module file converter.

getLegacyRootModuleFileConverter() public méthode

Returns the module file serializer with support for legacy versions.
public getLegacyRootModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter
Résultat Webmozart\Json\Conversion\JsonConverter The module file converter.

getLogger() public méthode

Returns the logger.
public getLogger ( ) : Psr\Log\LoggerInterface
Résultat Psr\Log\LoggerInterface The logger.

getModuleFileConverter() public méthode

Returns the module file converter.
public getModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter
Résultat Webmozart\Json\Conversion\JsonConverter The module file converter.

getModuleManager() public méthode

Returns the module manager.
public getModuleManager ( ) : Puli\Manager\Api\Module\ModuleManager
Résultat Puli\Manager\Api\Module\ModuleManager The module manager.

getRepository() public méthode

Returns the resource repository of the project.
public getRepository ( ) : Puli\Repository\Api\EditableRepository
Résultat Puli\Repository\Api\EditableRepository The resource repository.

getRepositoryManager() public méthode

Returns the resource repository manager.
public getRepositoryManager ( ) : Puli\Manager\Api\Repository\RepositoryManager
Résultat Puli\Manager\Api\Repository\RepositoryManager The repository manager.

getRootDirectory() public méthode

If no Puli project is managed at the moment, null is returned.
public getRootDirectory ( ) : string | null
Résultat string | null The root directory of the managed Puli project or `null` if none is set.

getRootModuleFileConverter() public méthode

Returns the module file converter.
public getRootModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter
Résultat Webmozart\Json\Conversion\JsonConverter The module file converter.

getRootModuleFileManager() public méthode

Returns the root module file manager.
public getRootModuleFileManager ( ) : Puli\Manager\Api\Module\RootModuleFileManager
Résultat Puli\Manager\Api\Module\RootModuleFileManager The module file manager.

getServerManager() public méthode

Returns the server manager.
public getServerManager ( ) : Puli\Manager\Api\Server\ServerManager
Résultat Puli\Manager\Api\Server\ServerManager The server manager.

getStorage() public méthode

Returns the file storage.
public getStorage ( ) : Puli\Manager\Api\Storage\Storage
Résultat Puli\Manager\Api\Storage\Storage The storage.

getUrlGenerator() public méthode

Returns the resource URL generator.
public getUrlGenerator ( ) : Puli\UrlGenerator\Api\UrlGenerator
Résultat Puli\UrlGenerator\Api\UrlGenerator The resource URL generator.

isStarted() public méthode

Returns whether the service container is started.
public isStarted ( ) : boolean
Résultat boolean Returns `true` if the container is started and `false` otherwise.

setEnvironment() public méthode

Sets the environment of the managed Puli project.
public setEnvironment ( string $env )
$env string One of the {@link Environment} constants.

setEventDispatcher() public méthode

Sets the event dispatcher to use.
public setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher )
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface The event dispatcher to use.

setLogger() public méthode

Sets the logger to use.
public setLogger ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface The logger to use.

setRootDirectory() public méthode

Sets the root directory of the managed Puli project.
public setRootDirectory ( string | null $rootDir )
$rootDir string | null The root directory of the managed Puli project or `null` to start Puli outside of a specific project.

start() public méthode

Starts the service container.
public start ( )