Skip to content

Commit 1eff7a5

Browse files
author
Brian Faust
committed
refactor: introduce FoundationServiceProvider to load service providers
1 parent 29eb126 commit 1eff7a5

File tree

7 files changed

+34
-38
lines changed

7 files changed

+34
-38
lines changed

composer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@
8686
"extra": {
8787
"laravel": {
8888
"providers": [
89-
"ARKEcosystem\\Foundation\\Providers\\UserInterfaceServiceProvider",
90-
"ARKEcosystem\\Foundation\\Providers\\HermesServiceProvider",
91-
"ARKEcosystem\\Foundation\\Providers\\FortifyServiceProvider",
92-
"ARKEcosystem\\Foundation\\Providers\\StanServiceProvider"
89+
"ARKEcosystem\\Foundation\\Providers\\FoundationServiceProvider"
9390
]
9491
}
9592
},
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ARKEcosystem\Foundation\Providers;
6+
7+
use Illuminate\Support\ServiceProvider;
8+
9+
class FoundationServiceProvider extends ServiceProvider
10+
{
11+
/**
12+
* Register any application services.
13+
*
14+
* @return void
15+
*/
16+
public function register()
17+
{
18+
$this->app->register(UserInterfaceServiceProvider::class);
19+
$this->app->register(MarkdownServiceProvider::class);
20+
$this->app->register(CommonMarkServiceProvider::class);
21+
$this->app->register(HermesServiceProvider::class);
22+
$this->app->register(FortifyServiceProvider::class);
23+
$this->app->register(StanServiceProvider::class);
24+
}
25+
}

tests/CommonMark/Extensions/Link/LinkRendererTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
declare(strict_types=1);
44

55
use ARKEcosystem\Foundation\CommonMark\Extensions\Link\LinkRenderer;
6-
use ARKEcosystem\Foundation\Providers\CommonMarkServiceProvider;
76
use League\CommonMark\Environment\Environment;
87
use League\CommonMark\Extension\CommonMark\Node\Inline\Link;
98
use League\CommonMark\Node\Inline\Text;

tests/UserInterface/Components/CurrencyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
declare(strict_types=1);
44

5-
use function Spatie\Snapshots\assertMatchesSnapshot;
65
use ARKEcosystem\Foundation\UserInterface\Components\Currency;
6+
use function Spatie\Snapshots\assertMatchesSnapshot;
77

88
it('should format the given value', function (): void {
99
assertMatchesSnapshot((new Currency('USD'))->render()(['slot' => 10]));

usage/commonmark.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,6 @@
55
## Installation
66

77
1. Publish all the assets / views with `php artisan vendor:publish --provider="ARKEcosystem\Foundation\Providers\CommonMarkServiceProvider" --tag=config`.
8-
2. Disable auto-discovery for all fortify packages. This step is required so that we can control the loading order of `graham-campbell/markdown` and `arkecosystem/foundation`.
9-
10-
```json
11-
"extra": {
12-
"laravel": {
13-
"dont-discover": ["arkecosystem/foundation", "graham-campbell/markdown"]
14-
}
15-
},
16-
```
17-
18-
4. Register the service providers in this exact order. This will ensure that our package can overwrite any bindings that `graham-campbell/markdown` created.
19-
20-
```php
21-
GrahamCampbell\Markdown\MarkdownServiceProvider::class,
22-
ARKEcosystem\Foundation\Providers\CommonMarkServiceProvider::class,
23-
```
248

259
## Usage
2610

usage/fortify.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,8 @@
55
## Installation
66

77
1. Publish all the assets / views with `php artisan vendor:publish --provider="ARKEcosystem\Foundation\Providers\FortifyServiceProvider" --tag=config --tag=images`.
8-
2. Disable auto-discovery for all fortify packages. This step is required so that we can control the loading order of `laravel/fortify` and `arkecosystem/foundation`.
9-
10-
```json
11-
"extra": {
12-
"laravel": {
13-
"dont-discover": ["arkecosystem/foundation", "laravel/fortify"]
14-
}
15-
},
16-
```
178

18-
4. Required Image
9+
2. Required Image
1910

2011
Projects require an image to be provided: `resources/images/auth/verify-email.svg`
2112

usage/ui.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ Since this package relies on a few 3rd party packages, you will need to have the
2323

2424
```js
2525
mix.webpackConfig({
26-
resolve: {
27-
alias: {
28-
'@ui': path.resolve(__dirname, 'vendor/arkecosystem/foundation/resources/assets/')
29-
}
26+
resolve: {
27+
alias: {
28+
'@ui': path.resolve(__dirname, 'vendor/arkecosystem/foundation/resources/assets/')
3029
}
31-
})
32-
...
30+
}
31+
})
32+
...
3333
```
3434

3535
**Protip**: instead of running step 3 manually, you can add the following to your `post-autoload-dump` property in `composer.json`:

0 commit comments

Comments
 (0)