PHP Class Flarum\Extension\ExtensionManager

Show file Open project: flarum/core Class Usage Examples

Protected Properties

Property Type Description
$app
$config
$dispatcher Illuminate\Contracts\Events\Dispatcher
$extensions Illuminate\Support\Collection | null
$filesystem Illuminate\Filesystem\Filesystem
$migrator

Public Methods

Method Description
__construct ( Flarum\Settings\SettingsRepositoryInterface $config, Application $app, Flarum\Database\Migrator $migrator, Illuminate\Contracts\Events\Dispatcher $dispatcher, Illuminate\Filesystem\Filesystem $filesystem )
disable ( string $name ) Disables an extension.
enable ( string $name ) Enables the extension.
getAsset ( Extension $extension, string $path ) : string Get the path to an extension's published asset.
getEnabled ( ) : array The id's of the enabled extensions.
getEnabledBootstrappers ( ) : Collection Loads all bootstrap.php files of the enabled extensions.
getEnabledExtensions ( ) : Collection Get only enabled extensions.
getExtension ( string $name ) : Extension | null Loads an Extension with all information.
getExtensions ( ) : Collection
getMigrator ( ) : Flarum\Database\Migrator The database migrator.
isEnabled ( $extension ) : boolean Whether the extension is enabled.
migrate ( Extension $extension, boolean | true $up = true ) Runs the database migrations for the extension.
migrateDown ( Extension $extension ) Runs the database migrations to reset the database to its old state.
uninstall ( string $name ) Uninstalls an extension.

Protected Methods

Method Description
getExtensionsDir ( ) : string The extensions path.
publishAssets ( Extension $extension ) Copy the assets from an extension's assets directory into public view.
setEnabled ( array $enabled ) Persist the currently enabled extensions.
unpublishAssets ( Extension $extension ) Delete an extension's assets from public view.

Method Details

__construct() public method

public __construct ( Flarum\Settings\SettingsRepositoryInterface $config, Application $app, Flarum\Database\Migrator $migrator, Illuminate\Contracts\Events\Dispatcher $dispatcher, Illuminate\Filesystem\Filesystem $filesystem )
$config Flarum\Settings\SettingsRepositoryInterface
$app Flarum\Foundation\Application
$migrator Flarum\Database\Migrator
$dispatcher Illuminate\Contracts\Events\Dispatcher
$filesystem Illuminate\Filesystem\Filesystem

disable() public method

Disables an extension.
public disable ( string $name )
$name string

enable() public method

Enables the extension.
public enable ( string $name )
$name string

getAsset() public method

Get the path to an extension's published asset.
public getAsset ( Extension $extension, string $path ) : string
$extension Extension
$path string
return string

getEnabled() public method

The id's of the enabled extensions.
public getEnabled ( ) : array
return array

getEnabledBootstrappers() public method

Loads all bootstrap.php files of the enabled extensions.
public getEnabledBootstrappers ( ) : Collection
return Illuminate\Support\Collection

getEnabledExtensions() public method

Get only enabled extensions.
public getEnabledExtensions ( ) : Collection
return Illuminate\Support\Collection

getExtension() public method

Loads an Extension with all information.
public getExtension ( string $name ) : Extension | null
$name string
return Extension | null

getExtensions() public method

public getExtensions ( ) : Collection
return Illuminate\Support\Collection

getExtensionsDir() protected method

The extensions path.
protected getExtensionsDir ( ) : string
return string

getMigrator() public method

The database migrator.
public getMigrator ( ) : Flarum\Database\Migrator
return Flarum\Database\Migrator

isEnabled() public method

Whether the extension is enabled.
public isEnabled ( $extension ) : boolean
$extension
return boolean

migrate() public method

Runs the database migrations for the extension.
public migrate ( Extension $extension, boolean | true $up = true )
$extension Extension
$up boolean | true

migrateDown() public method

Runs the database migrations to reset the database to its old state.
public migrateDown ( Extension $extension )
$extension Extension

publishAssets() protected method

Copy the assets from an extension's assets directory into public view.
protected publishAssets ( Extension $extension )
$extension Extension

setEnabled() protected method

Persist the currently enabled extensions.
protected setEnabled ( array $enabled )
$enabled array

uninstall() public method

Uninstalls an extension.
public uninstall ( string $name )
$name string

unpublishAssets() protected method

Delete an extension's assets from public view.
protected unpublishAssets ( Extension $extension )
$extension Extension

Property Details

$app protected property

protected $app

$config protected property

protected $config

$dispatcher protected property

protected Dispatcher,Illuminate\Contracts\Events $dispatcher
return Illuminate\Contracts\Events\Dispatcher

$extensions protected property

protected Collection,Illuminate\Support|null $extensions
return Illuminate\Support\Collection | null

$filesystem protected property

protected Filesystem,Illuminate\Filesystem $filesystem
return Illuminate\Filesystem\Filesystem

$migrator protected property

protected $migrator