Skip to content

Commit 5eb4b97

Browse files
dgafkagitbook-bot
authored andcommitted
GITBOOK-862: No subject
1 parent 0a3216e commit 5eb4b97

File tree

1 file changed

+60
-36
lines changed

1 file changed

+60
-36
lines changed

install-php-service-bus.md

Lines changed: 60 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,90 +6,114 @@ description: Installing Ecotone for Symfony, Laravel or Stand Alone
66

77
## Install for Symfony
88

9-
1. Use composer in order to download `Ecotone Symfony Bundle`
9+
Use composer in order to download **Ecotone Symfony Bundle**
1010

1111
{% hint style="success" %}
1212
composer require [ecotone/](https://packagist.org/packages/ecotone/)symfony-bundle
1313
{% endhint %}
1414

15-
If you're using _`Symfony Flex`_, bundle will auto-configure. 
15+
If you're using **Symfony Flex**, bundle will auto-configure. \
16+
If that did not happen, register bundle in **config/bundles.php**
1617

17-
2\. Register bundle, if needed
18+
```php
19+
Ecotone\SymfonyBundle\EcotoneSymfonyBundle::class => ['all' => true]
20+
```
1821

19-
{% hint style="success" %}
20-
new Ecotone\SymfonyBundle\EcotoneSymfonyBundle::class => \['all' => true]
22+
{% hint style="warning" %}
23+
By default Ecotone will look for Attributes in default Symfony catalog **"src"**. \
24+
If you do follow different structure, you can use [**"namespaces"**](modules/symfony/symfony-ddd-cqrs-event-sourcing.md#namespaces) configuration to tell Ecotone, where to look for. 
2125
{% endhint %}
2226

27+
***
28+
2329
## Install for Laravel
2430

25-
1. Use composer in order to download `Ecotone Laravel`
31+
Use composer in order to download **Ecotone Laravel**
2632

2733
{% hint style="success" %}
2834
composer require [ecotone/](https://packagist.org/packages/ecotone/)laravel
2935
{% endhint %}
3036

31-
Provider should be automatically registered.
32-
33-
2\. Register provider, if needed
37+
Provider should be automatically registered.\
38+
If that did not happen, register provider
3439

3540
```php
3641
'providers' => [
3742
\Ecotone\Laravel\EcotoneProvider::class
3843
],
3944
```
4045

41-
## Install Ecotone Lite (No framework)
42-
43-
If you're using no framework or framework `different` than `Symfony` or `Laravel`, then you may use `Ecotone Lite` to bootstrap Ecotone.
44-
45-
{% hint style="info" %}
46-
In order to start, you need have to `composer.json` with PSR-4 or PSR-0 autoload setup.
46+
{% hint style="warning" %}
47+
By default Ecotone will look for Attributes in default Laravel catalog **"app"**. \
48+
If you do follow different structure, you can use [**"namespaces"**](modules/laravel/laravel-ddd-cqrs-event-sourcing.md#namespaces) configuration to tell Ecotone, where to look for. 
4749
{% endhint %}
4850

49-
### Ecotone Lite Application
51+
***
5052

51-
You may use out of the box Ecotone Lite Application, which provide you with Dependency Container.
53+
## Install Ecotone Lite (No framework)
54+
55+
If you're using no framework or framework **different** than **Symfony** or **Laravel**, then you may use **Ecotone Lite** to bootstrap Ecotone.
5256

5357
{% hint style="success" %}
54-
composer require ecotone/lite-application
58+
composer require ecotone/ecotone
5559
{% endhint %}
5660

57-
```php
58-
$ecotoneLite = EcotoneLiteApplication::bootstrap();
59-
60-
$commandBus = $ecotoneLite->getCommandBus();
61-
$queryBus = $ecotoneLite->getQueryBus();
62-
```
63-
6461
{% hint style="info" %}
65-
With default configuration, Ecotone will look for classes inside `src` catalog.
62+
In order to start, you need have to `composer.json` with PSR-4 or PSR-0 autoload setup.
6663
{% endhint %}
6764

6865
### With Custom Dependency Container
6966

7067
If you already have Dependency Container configured, then:
7168

72-
{% hint style="success" %}
73-
composer require ecotone/ecotone
74-
{% endhint %}
75-
7669
```php
7770
$ecotoneLite = EcotoneLite::bootstrap(
71+
classesToResolve: [User::class, UserRepository::class, UserService::class],
7872
containerOrAvailableServices: $container
7973
);
8074
```
8175

76+
### Load namespaces
77+
78+
By default Ecotone will look for Attributes only in Classes provided under **"classesToResolve"**. \
79+
If we want to look for Attributes in given set of Namespaces, we can pass it to the configuration.
80+
81+
```php
82+
$ecotoneLite = EcotoneLite::bootstrap(
83+
classesToResolve: [User::class, UserRepository::class, UserService::class],
84+
containerOrAvailableServices: $container,
85+
configuration: ServiceConfiguration::createWithDefaults()->withNamespaces(['App'])
86+
);
87+
```
88+
8289
### With no Dependency Container
8390

84-
You may actually run Ecotone without any Dependency Container. That may be useful for small applications, testing or when we want just run some Ecotone's script.
91+
You may actually run Ecotone without any Dependency Container. That may be useful for small applications, testing or when we want to run some small Ecotone's script.
92+
93+
```php
94+
$ecotoneLite = EcotoneLite::bootstrap(
95+
classesToResolve: [User::class, UserRepository::class, UserService::class],
96+
containerOrAvailableServices: [new UserRepository(), new UserService()]
97+
);
98+
```
99+
100+
***
101+
102+
## Ecotone Lite Application
103+
104+
You may use out of the box Ecotone Lite Application, which provide you with Dependency Container.
85105

86106
{% hint style="success" %}
87-
composer require ecotone/ecotone
107+
composer require ecotone/lite-application
88108
{% endhint %}
89109

90110
```php
91-
$ecotoneLite = EcotoneLite::bootstrap(
92-
[User::class, UserRepository::class, UserService::class],
93-
[new UserRepository(), new UserService()]
94-
);
111+
$ecotoneLite = EcotoneLiteApplication::bootstrap();
112+
113+
$commandBus = $ecotoneLite->getCommandBus();
114+
$queryBus = $ecotoneLite->getQueryBus();
95115
```
116+
117+
{% hint style="info" %}
118+
With default configuration, Ecotone will look for classes inside **"src"** catalog.
119+
{% endhint %}

0 commit comments

Comments
 (0)