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)

Loads an Extension with all information.

enable(string $name)

Enables the extension.

disable(string $name)

Disables an extension.

uninstall(string $name)

Uninstalls an extension.

publishAssets(Extension $extension)

Copy the assets from an extension's assets directory into public view.

unpublishAssets(Extension $extension)

Delete an extension's assets from public view.

string
getAsset(Extension $extension, string $path)

Get the path to an extension's published asset.

Cloud
getAssetsFilesystem()

Get an instance of the assets filesystem.

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

Runs the database migrations for the extension.

void
migrateDown(Extension $extension)

Runs the database migrations to reset the database to its old state.

getMigrator()

The database migrator.

array|Extension[]
getEnabledExtensions()

Get only enabled extensions.

extend(Container $container)

Call on all enabled extensions to extend the Flarum application.

array
getEnabled()

The id's of the enabled extensions.

setEnabledExtensions(array $enabledExtensions)

Persist the currently enabled extensions.

bool
isEnabled($extension)

Whether the extension is enabled.

static string[]
pluckTitles(array $exts)

Returns the titles of the extensions passed.

static 
resolveExtensionOrder(Extension[] $extensionList)

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

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)

Loads an Extension with all information.

Parameters

string $name

Return Value

Extension|null

enable(string $name)

Enables the extension.

Parameters

string $name

disable(string $name)

Disables an extension.

Parameters

string $name

uninstall(string $name)

Uninstalls an extension.

Parameters

string $name

protected publishAssets(Extension $extension)

Copy the assets from an extension's assets directory into public view.

Parameters

Extension $extension

protected unpublishAssets(Extension $extension)

Delete an extension's assets from public view.

Parameters

Extension $extension

string getAsset(Extension $extension, string $path)

Get the path to an extension's published asset.

Parameters

Extension $extension
string $path

Return Value

string

protected Cloud getAssetsFilesystem()

Get an instance of the assets filesystem.

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

Return Value

Cloud

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

Runs the database migrations for the extension.

Parameters

Extension $extension
string $direction

Return Value

int

void migrateDown(Extension $extension)

Runs the database migrations to reset the database to its old state.

Parameters

Extension $extension

Return Value

void

Migrator getMigrator()

The database migrator.

Return Value

Migrator

array|Extension[] getEnabledExtensions()

Get only enabled extensions.

Return Value

array|Extension[]

extend(Container $container)

Call on all enabled extensions to extend the Flarum application.

Parameters

Container $container

array getEnabled()

The id's of the enabled extensions.

Return Value

array

protected setEnabledExtensions(array $enabledExtensions)

Persist the currently enabled extensions.

Parameters

array $enabledExtensions

bool isEnabled($extension)

Whether the extension is enabled.

Parameters

$extension

Return Value

bool

static string[] pluckTitles(array $exts)

Returns the titles of the extensions passed.

Parameters

array $exts

Return Value

string[]

static resolveExtensionOrder(Extension[] $extensionList)

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

Effectively just topological sorting.

Parameters

Extension[] $extensionList