diff --git a/composer.json b/composer.json index 3827efd..34f1ae3 100644 --- a/composer.json +++ b/composer.json @@ -22,10 +22,9 @@ "issues": "https://github.com/log1x/sage-directives/issues" }, "autoload": { - "files": [ - "src/Directives.php", - "src/Utilities.php" - ] + "psr-4": { + "Log1x\\SageDirectives\\": "src/" + } }, "require": { "php": ">=7.1.3" @@ -40,5 +39,12 @@ }, "suggest": { "log1x/sage-svg": "Required to use the @svg directive (Sage 10)." + }, + "extra": { + "acorn": { + "providers": [ + "Log1x\\SageDirectives\\SageDirectivesServiceProvider" + ] + } } } diff --git a/src/Directives.php b/src/SageDirectivesServiceProvider.php similarity index 93% rename from src/Directives.php rename to src/SageDirectivesServiceProvider.php index 441a688..d1724c3 100644 --- a/src/Directives.php +++ b/src/SageDirectivesServiceProvider.php @@ -2,7 +2,9 @@ namespace Log1x\SageDirectives; -class Directives +use Illuminate\Support\ServiceProvider; + +class SageDirectivesServiceProvider extends ServiceProvider { /** * Directives @@ -27,7 +29,7 @@ class Directives * * @return void */ - public function __construct() + public function boot() { add_action('after_setup_theme', function () { $this->namespace = apply_filters('log1x/sage-directives/namespace', $this->namespace); @@ -91,8 +93,3 @@ protected function blade() } } } - -// phpcs:disable -if (function_exists('add_action')) { - new Directives(); -} diff --git a/src/Utilities.php b/src/Util.php similarity index 100% rename from src/Utilities.php rename to src/Util.php