diff --git a/framework/core/src/Foundation/AbstractServer.php b/framework/core/src/Foundation/AbstractServer.php index 5f6115029..6d5de36a0 100644 --- a/framework/core/src/Foundation/AbstractServer.php +++ b/framework/core/src/Foundation/AbstractServer.php @@ -42,6 +42,11 @@ abstract class AbstractServer */ protected $config; + /** + * @var callable[] + */ + protected $registerCallbacks = []; + /** * @param null $basePath * @param null $publicPath @@ -128,6 +133,14 @@ abstract class AbstractServer $this->config = $config; } + /** + * @param callable $callback + */ + public function register(callable $callback) + { + $this->registerCallbacks[] = $callback; + } + /** * @return Application */ @@ -179,6 +192,11 @@ abstract class AbstractServer $app->register('Flarum\Api\ApiServiceProvider'); $app->register('Flarum\Forum\ForumServiceProvider'); $app->register('Flarum\Admin\AdminServiceProvider'); + + foreach ($this->registerCallbacks as $callback) { + $callback($app); + } + $app->register('Flarum\Extension\ExtensionServiceProvider'); }