class ExtensionManager

Properties

protected $config
protected Paths $paths
protected $container
protected $migrator
protected Dispatcher $dispatcher
protected Filesystem $filesystem
protected Collection|null $extensions

Methods

__construct(SettingsRepositoryInterface $config, Paths $paths, Container $container, Migrator $migrator, Dispatcher $dispatcher, Filesystem $filesystem)

No description

Collection
getExtensions()

No description

Extension|null
getExtension(string $name)

<p>Loads an Extension with all information.</p>

enable(string $name)

<p>Enables the extension.</p>

disable(string $name)

<p>Disables an extension.</p>

uninstall(string $name)

<p>Uninstalls an extension.</p>

publishAssets(Extension $extension)

<p>Copy the assets from an extension's assets directory into public view.</p>

unpublishAssets(Extension $extension)

<p>Delete an extension's assets from public view.</p>

string
getAsset(Extension $extension, string $path)

<p>Get the path to an extension's published asset.</p>

Cloud
getAssetsFilesystem()

<p>Get an instance of the assets filesystem.</p>

void
migrate(Extension $extension, string $direction = 'up')

<p>Runs the database migrations for the extension.</p>

array
migrateDown(Extension $extension)

<p>Runs the database migrations to reset the database to its old state.</p>

getMigrator()

<p>The database migrator.</p>

array|Extension[]
getEnabledExtensions()

<p>Get only enabled extensions.</p>

extend(Container $container)

<p>Call on all enabled extensions to extend the Flarum application.</p>

array
getEnabled()

<p>The id's of the enabled extensions.</p>

setEnabledExtensions(array $enabledExtensions)

<p>Persist the currently enabled extensions.</p>

bool
isEnabled($extension)

<p>Whether the extension is enabled.</p>

static string[]
pluckTitles(array $exts)

<p>Returns the titles of the extensions passed.</p>

static array
resolveExtensionOrder(Extension[] $extensionList)

<p>Sort a list of extensions so that they are properly resolved in respect to order.</p>

Details

__construct(SettingsRepositoryInterface $config, Paths $paths, Container $container, Migrator $migrator, Dispatcher $dispatcher, Filesystem $filesystem)

Parameters

SettingsRepositoryInterface $config
Paths $paths
Container $container
Migrator $migrator
Dispatcher $dispatcher
Filesystem $filesystem

Collection getExtensions()

Return Value

Collection

Extension|null getExtension(string $name)

<p>Loads an Extension with all information.</p>

Parameters

string $name

Return Value

Extension|null

enable(string $name)

<p>Enables the extension.</p>

Parameters

string $name

disable(string $name)

<p>Disables an extension.</p>

Parameters

string $name

uninstall(string $name)

<p>Uninstalls an extension.</p>

Parameters

string $name

protected publishAssets(Extension $extension)

<p>Copy the assets from an extension's assets directory into public view.</p>

Parameters

Extension $extension

protected unpublishAssets(Extension $extension)

<p>Delete an extension's assets from public view.</p>

Parameters

Extension $extension

string getAsset(Extension $extension, string $path)

<p>Get the path to an extension's published asset.</p>

Parameters

Extension $extension
string $path

Return Value

string

protected Cloud getAssetsFilesystem()

<p>Get an instance of the assets filesystem.</p>

<p>This is resolved dynamically because Flarum's filesystem configuration might not be booted yet when the ExtensionManager singleton initializes.</p>

Return Value

Cloud

void migrate(Extension $extension, string $direction = 'up')

<p>Runs the database migrations for the extension.</p>

Parameters

Extension $extension
string $direction

Return Value

void

array migrateDown(Extension $extension)

<p>Runs the database migrations to reset the database to its old state.</p>

Parameters

Extension $extension

Return Value

array <p>Notes from the migrator.</p>

Migrator getMigrator()

<p>The database migrator.</p>

Return Value

Migrator

array|Extension[] getEnabledExtensions()

<p>Get only enabled extensions.</p>

Return Value

array|Extension[]

extend(Container $container)

<p>Call on all enabled extensions to extend the Flarum application.</p>

Parameters

Container $container

array getEnabled()

<p>The id's of the enabled extensions.</p>

Return Value

array

protected setEnabledExtensions(array $enabledExtensions)

<p>Persist the currently enabled extensions.</p>

Parameters

array $enabledExtensions

bool isEnabled($extension)

<p>Whether the extension is enabled.</p>

Parameters

$extension

Return Value

bool

static string[] pluckTitles(array $exts)

<p>Returns the titles of the extensions passed.</p>

Parameters

array $exts

Return Value

string[]

static array resolveExtensionOrder(Extension[] $extensionList)

<p>Sort a list of extensions so that they are properly resolved in respect to order.</p>

<p>Effectively just topological sorting.</p>

Parameters

Extension[] $extensionList

Return Value

array <p>with 2 keys: 'valid' points to an ordered array of \Flarum\Extension\Extension 'missingDependencies' points to an associative array of extensions that could not be resolved due to missing dependencies, in the format extension id =&gt; array of missing dependency IDs. 'circularDependencies' points to an array of extensions ids of extensions that cannot be processed due to circular dependencies</p>