From 70aad41d2e2e8997b9063d6633ab60e918e6ce90 Mon Sep 17 00:00:00 2001 From: Jonas Schelde Date: Sun, 8 Oct 2023 21:08:13 +0200 Subject: [PATCH 1/5] Added mac :DS_Store files to gitignore --- .gitignore | 1 + Makefile | 1 + composer.json | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 841e6e5..a816169 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ psalm.xml vendor .php-cs-fixer.cache +.DS_Store diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1b96f7b --- /dev/null +++ b/Makefile @@ -0,0 +1 @@ +shell diff --git a/composer.json b/composer.json index 351d7bb..b029b2e 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ }, "require-dev": { "pestphp/pest": "^2.0", - "laravel/pint": "^2.3", + "laravel/pint": "^v1.13.2", "spatie/ray": "^1.28" }, "autoload": { @@ -46,4 +46,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} \ No newline at end of file +} From e6047ebaadbc49738477cbd2b316c01245305214 Mon Sep 17 00:00:00 2001 From: Jonas Schelde Date: Mon, 9 Oct 2023 00:19:37 +0200 Subject: [PATCH 2/5] Added: Service Provider with package discovery in composer.json --- Makefile | 5 ++++- composer.json | 12 ++++++++++-- src/Commands/TestCommand.php | 2 +- src/LaravelPareto.php | 7 ------- src/ServiceProvider.php | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 11 deletions(-) delete mode 100755 src/LaravelPareto.php create mode 100644 src/ServiceProvider.php diff --git a/Makefile b/Makefile index 1b96f7b..c94ed92 100644 --- a/Makefile +++ b/Makefile @@ -1 +1,4 @@ -shell +shell:=/bin/bash + +composer_install: + @php81 composer install diff --git a/composer.json b/composer.json index b029b2e..38c9c84 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ "require-dev": { "pestphp/pest": "^2.0", "laravel/pint": "^v1.13.2", - "spatie/ray": "^1.28" + "spatie/ray": "^1.28", + "illuminate/support": "^9.21|^10.0" }, "autoload": { "psr-4": { @@ -45,5 +46,12 @@ } }, "minimum-stability": "dev", - "prefer-stable": true + "prefer-stable": true, + "extra": { + "laravel": { + "providers": [ + "EmilHorlyck\\LaravelPareto\\ServiceProvider" + ] + } + } } diff --git a/src/Commands/TestCommand.php b/src/Commands/TestCommand.php index bbab610..e282037 100644 --- a/src/Commands/TestCommand.php +++ b/src/Commands/TestCommand.php @@ -12,6 +12,6 @@ class TestCommand extends Command public function handle(): int { - this->info('Test command'); + $this->info('Test command'); } } diff --git a/src/LaravelPareto.php b/src/LaravelPareto.php deleted file mode 100755 index 7ed5aba..0000000 --- a/src/LaravelPareto.php +++ /dev/null @@ -1,7 +0,0 @@ -app->register(ServiceProvider::class); + + dd('hej'); + } + + /** + * Bootstrap services. + */ + public function boot(): void + { + if ($this->app->runningInConsole()) { + $this->commands([ + TestCommand::class + ]); + } + + dd('hej'); + } +} From c6a539448c1ae451b66ad8af0954d3beb4a6b24f Mon Sep 17 00:00:00 2001 From: Jonas Schelde Date: Mon, 9 Oct 2023 00:22:00 +0200 Subject: [PATCH 3/5] Fixed: Command being in correct namespace for following PSR-4 --- composer.json | 3 ++- src/Commands/TestCommand.php | 2 +- src/ServiceProvider.php | 4 ---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 38c9c84..1bab9ea 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "pestphp/pest": "^2.0", "laravel/pint": "^v1.13.2", "spatie/ray": "^1.28", - "illuminate/support": "^9.21|^10.0" + "illuminate/support": "^9.21|^10.0", + "illuminate/console": "^v9.21|^v10.0" }, "autoload": { "psr-4": { diff --git a/src/Commands/TestCommand.php b/src/Commands/TestCommand.php index e282037..3be0721 100644 --- a/src/Commands/TestCommand.php +++ b/src/Commands/TestCommand.php @@ -1,6 +1,6 @@ app->register(ServiceProvider::class); - - dd('hej'); } /** @@ -26,7 +24,5 @@ public function boot(): void TestCommand::class ]); } - - dd('hej'); } } From b6555c6b1b4eb723698e57e89949c0a65ea2148d Mon Sep 17 00:00:00 2001 From: Jonas Schelde Date: Mon, 9 Oct 2023 00:23:06 +0200 Subject: [PATCH 4/5] Fixed: Naming of import for command in service provider --- src/ServiceProvider.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index f3cbad0..fdf0b30 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -3,6 +3,7 @@ namespace EmilHorlyck\LaravelPareto; use Illuminate\Support\ServiceProvider as BaseServiceProvider; +use EmilHorlyck\LaravelPareto\Commands\TestCommand; class ServiceProvider extends BaseServiceProvider { From c98e686259bf4e9e292082367c00f7af268cabc1 Mon Sep 17 00:00:00 2001 From: Jonas Schelde Date: Mon, 9 Oct 2023 00:24:28 +0200 Subject: [PATCH 5/5] Removed: Registering its own service provider. no need after adding extra step in composer --- src/ServiceProvider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index fdf0b30..7081aea 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -12,7 +12,6 @@ class ServiceProvider extends BaseServiceProvider */ public function register(): void { - $this->app->register(ServiceProvider::class); } /**