Skip to content

Commit 30ec400

Browse files
authored
Merge pull request #60 from tyrsson/tweak-docs
Tweak docs for new namespaces
2 parents 273b25a + 7214954 commit 30ec400

8 files changed

Lines changed: 50 additions & 50 deletions

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ A Command Bus implementation for Mezzio applications, providing a clean way to h
66

77
### Core Components
88

9-
- [CmdBus](docs/cmdbus.md) - The main command bus implementation
10-
- [CmdBusInterface](docs/cmdbus-interface.md) - Command bus contract
9+
- [CommandBus](docs/commandbus.md) - The main command bus implementation
10+
- [CommandBusInterface](docs/commandbus-interface.md) - Command bus contract
1111
- [MiddlewarePipe](docs/middleware-pipe.md) - Middleware pipeline management
1212
- [MiddlewarePipelineInterface](docs/middleware-pipeline-interface.md) - Pipeline contract
1313
- [CommandHandlerFactory](docs/command-handler-factory.md) - Factory for command handlers
@@ -22,7 +22,7 @@ A Command Bus implementation for Mezzio applications, providing a clean way to h
2222

2323
### Container Factories
2424

25-
- [CmdBusFactory](docs/container/cmdbus-factory.md) - Service factory for CmdBus
25+
- [CommandBusFactory](docs/container/cmdbus-factory.md) - Service factory for CmdBus
2626
- [CommandHandlerFactoryFactory](docs/container/command-handler-factory-factory.md) - Factory for CommandHandlerFactory
2727
- [CommandHandlerMiddlewareFactory](docs/container/command-handler-middleware-factory.md) - Factory for CommandHandlerMiddleware
2828
- [MiddlewarePipeFactory](docs/container/middleware-pipe-factory.md) - Factory for MiddlewarePipe

docs/command-handler-interface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ final class CreateUserHandler implements CommandHandlerInterface
6161
- [CommandInterface](command-interface.md) - Commands that handlers process
6262
- [CommandHandlerFactory](command-handler-factory.md) - Factory for resolving handlers
6363
- [CommandHandlerMiddleware](middleware/command-handler-middleware.md) - Middleware that executes handlers
64-
- [CmdBusInterface](cmdbus-interface.md) - Interface that extends this one
64+
- [CommandBusInterface](CommandBus-interface.md) - Interface that extends this one

docs/command-interface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ final readonly class CreateUserCommand implements CommandInterface
6262
## Related Components
6363

6464
- [CommandHandlerInterface](command-handler-interface.md) - Handlers that process commands
65-
- [CmdBusInterface](cmdbus-interface.md) - Bus that dispatches commands
65+
- [CommandBusInterface](CommandBus-interface.md) - Bus that dispatches commands
6666
- [MiddlewareInterface](middleware-interface.md) - Middleware that can intercept commands
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# CmdBusInterface
1+
# CommandBusInterface
22

33
The core contract defining the command bus behavior in the cmd-bus library.
44

55
## Overview
66

7-
`CmdBusInterface` extends `CommandHandlerInterface` to provide a unified contract for command processing. This interface ensures that any command bus implementation can handle commands consistently.
7+
`CommandBusInterface` extends `CommandHandlerInterface` to provide a unified contract for command processing. This interface ensures that any command bus implementation can handle commands consistently.
88

99
## Class Definition
1010

1111
```php
12-
interface CmdBusInterface extends CommandHandlerInterface
12+
interface CommandBusInterface extends CommandHandlerInterface
1313
{
1414
}
1515
```
@@ -24,7 +24,7 @@ public function handle(CommandInterface $command): mixed;
2424

2525
## Purpose
2626

27-
The `CmdBusInterface` serves as:
27+
The `CommandBusInterface` serves as:
2828

2929
1. **Abstraction Layer** - Allows different command bus implementations
3030
2. **Dependency Injection Target** - Services can depend on the interface rather than concrete implementations
@@ -38,7 +38,7 @@ The `CmdBusInterface` serves as:
3838
class OrderHandler
3939
{
4040
public function __construct(
41-
private CmdBusInterface $commandBus
41+
private CommandBusInterface $commandBus
4242
) {}
4343

4444
public function handle(ServerRequestInterface $request): ResponseInterface
@@ -67,7 +67,7 @@ class OrderHandler
6767
class ProcessCommandMiddleware implements MiddlewareInterface
6868
{
6969
public function __construct(
70-
private CmdBusInterface $commandBus
70+
private CommandBusInterface $commandBus
7171
) {}
7272

7373
public function process(
@@ -88,10 +88,10 @@ class ProcessCommandMiddleware implements MiddlewareInterface
8888

8989
## Default Implementation
9090

91-
The library provides a default implementation via the `CmdBus` class:
91+
The library provides a default implementation via the `CommandBus` class:
9292

9393
```php
94-
final class CmdBus implements CmdBusInterface
94+
final class CommandBus implements CommandBusInterface
9595
{
9696
public function handle(CommandInterface $command): mixed
9797
{
@@ -102,7 +102,7 @@ final class CmdBus implements CmdBusInterface
102102

103103
## Related Components
104104

105-
- [CmdBus](cmdbus.md) - Default implementation of this interface
105+
- [CommandBus](CommandBus.md) - Default implementation of this interface
106106
- [CommandHandlerInterface](command-handler-interface.md) - Parent interface
107107
- [CommandInterface](command-interface.md) - Interface for commands
108-
- [CmdBusFactory](container/cmdbus-factory.md) - Factory for creating command bus instances
108+
- [CommandBusFactory](container/CommandBus-factory.md) - Factory for creating command bus instances

docs/cmdbus.md renamed to docs/commandbus.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# CmdBus
1+
# CommandBus
22

33
The main command bus implementation that orchestrates command processing through a middleware pipeline.
44

55
## Overview
66

7-
`CmdBus` is the primary entry point for command processing. It accepts commands and delegates their execution to a configured middleware pipeline. This class provides a clean interface for command dispatch while allowing flexible middleware composition.
7+
`CommandBus` is the primary entry point for command processing. It accepts commands and delegates their execution to a configured middleware pipeline. This class provides a clean interface for command dispatch while allowing flexible middleware composition.
88

99
## Class Definition
1010

1111
```php
12-
final class CmdBus implements CmdBusInterface
12+
final class CommandBus implements CommandBusInterface
1313
{
1414
public function __construct(
1515
private MiddlewarePipelineInterface&MiddlewarePipe $pipeline
@@ -46,12 +46,12 @@ Processes a command through the configured middleware pipeline.
4646

4747
```php
4848
use App\Command\CreateUserCommand;
49-
use Webware\CommandBus\CmdBusInterface;
49+
use Webware\CommandBus\CommandBusInterface;
5050

5151
class UserHandler
5252
{
5353
public function __construct(
54-
private CmdBusInterface $commandBus
54+
private CommandBusInterface $commandBus
5555
) {}
5656

5757
public function createAction(): ResponseInterface
@@ -70,7 +70,7 @@ class UserHandler
7070

7171
## Related Components
7272

73-
- [CmdBusInterface](cmdbus-interface.md) - The interface this class implements
73+
- [CommandBusInterface](CommandBus-interface.md) - The interface this class implements
7474
- [MiddlewarePipe](middleware-pipe.md) - The pipeline component used internally
75-
- [CmdBusFactory](container/cmdbus-factory.md) - Factory for creating instances
75+
- [CommandBusFactory](container/CommandBus-factory.md) - Factory for creating instances
7676
- [CommandInterface](command-interface.md) - Interface all commands must implement

docs/config-provider.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ The ConfigProvider automatically registers these services:
9696

9797
### Core Services
9898

99-
- `CmdBusInterface``CmdBus`
99+
- `CommandBusInterface``CommandBus`
100100
- `MiddlewarePipelineInterface``MiddlewarePipe`
101101

102102
### Factories
103103

104-
- `CmdBus``Container\CmdBusFactory`
104+
- `CommandBus``Container\CommandBusFactory`
105105
- `CommandHandlerFactory``Container\CommandHandlerFactoryFactory`
106106
- `MiddlewarePipe``Container\MiddlewarePipeFactory`
107107
- `CommandHandlerMiddleware``Container\CommandHandlerMiddlewareFactory`
@@ -133,7 +133,7 @@ The ConfigProvider automatically registers these services:
133133

134134
## Related Components
135135

136-
- [CmdBus](cmdbus.md) - Main service configured by this provider
136+
- [CommandBus](CommandBus.md) - Main service configured by this provider
137137
- [MiddlewarePipe](middleware-pipe.md) - Pipeline service configured by this provider
138138
- [CommandHandlerFactory](command-handler-factory.md) - Factory for resolving handlers
139139
- [Container Factories](container/) - Service factories registered by this provider
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# CmdBusFactory
1+
# CommandBusFactory
22

3-
Factory class for creating `CmdBus` instances with proper dependency injection via Laminas ServiceManager.
3+
Factory class for creating `CommandBus` instances with proper dependency injection via Laminas ServiceManager.
44

55
## Overview
66

7-
`CmdBusFactory` is a Laminas ServiceManager factory that creates and configures `CmdBus` instances. It handles dependency resolution and ensures the command bus is properly initialized with its required middleware pipeline.
7+
`CommandBusFactory` is a Laminas ServiceManager factory that creates and configures `CommandBus` instances. It handles dependency resolution and ensures the command bus is properly initialized with its required middleware pipeline.
88

99
## Class Definition
1010

1111
```php
12-
final class CmdBusFactory
12+
final class CommandBusFactory
1313
{
14-
public function __invoke(ContainerInterface $container): CmdBus;
14+
public function __invoke(ContainerInterface $container): CommandBus;
1515
}
1616
```
1717

1818
## Implementation
1919

2020
```php
21-
public function __invoke(ContainerInterface $container): CmdBus
21+
public function __invoke(ContainerInterface $container): CommandBus
2222
{
2323
if (!$container->has(MiddlewarePipelineInterface::class)) {
2424
throw ServiceNotFoundException::fromService(MiddlewarePipelineInterface::class);
@@ -27,7 +27,7 @@ public function __invoke(ContainerInterface $container): CmdBus
2727
/** @var MiddlewarePipelineInterface&MiddlewarePipe $middlewarePipeline */
2828
$middlewarePipeline = $container->get(MiddlewarePipelineInterface::class);
2929

30-
return new CmdBus($middlewarePipeline);
30+
return new CommandBus($middlewarePipeline);
3131
}
3232
```
3333

@@ -46,10 +46,10 @@ The factory is automatically registered by the `ConfigProvider`:
4646
```php
4747
// In ConfigProvider::getDependencies()
4848
'factories' => [
49-
CmdBus::class => Container\CmdBusFactory::class,
49+
CommandBus::class => Container\CommandBusFactory::class,
5050
],
5151
'aliases' => [
52-
CmdBusInterface::class => CmdBus::class,
52+
CommandBusInterface::class => CommandBus::class,
5353
],
5454
```
5555

@@ -60,10 +60,10 @@ The factory is automatically registered by the `ConfigProvider`:
6060
return [
6161
'dependencies' => [
6262
'factories' => [
63-
Webware\CommandBus\CmdBus::class => Webware\CommandBus\Container\CmdBusFactory::class,
63+
Webware\CommandBus\CommandBus::class => Webware\CommandBus\Container\CommandBusFactory::class,
6464
],
6565
'aliases' => [
66-
Webware\CommandBus\CmdBusInterface::class => Webware\CommandBus\CmdBus::class,
66+
Webware\CommandBus\CommandBusInterface::class => Webware\CommandBus\CommandBus::class,
6767
],
6868
],
6969
];
@@ -73,21 +73,21 @@ return [
7373

7474
```php
7575
// In your application code
76-
$commandBus = $container->get(CmdBusInterface::class);
76+
$commandBus = $container->get(CommandBusInterface::class);
7777

7878
// Or directly
79-
$commandBus = $container->get(CmdBus::class);
79+
$commandBus = $container->get(CommandBus::class);
8080
```
8181

8282
### Factory in Action
8383

8484
```php
8585
use Psr\Container\ContainerInterface;
86-
use Webware\CommandBus\Container\CmdBusFactory;
86+
use Webware\CommandBus\Container\CommandBusFactory;
8787

8888
// Container setup (typically handled by Mezzio/Laminas)
8989
$container = new ServiceManager();
90-
$factory = new CmdBusFactory();
90+
$factory = new CommandBusFactory();
9191

9292
// Factory creates the command bus
9393
$commandBus = $factory($container);
@@ -104,7 +104,7 @@ $result = $commandBus->handle($command);
104104
class ExampleRequestHandler
105105
{
106106
public function __construct(
107-
private CmdBusInterface $commandBus
107+
private CommandBusInterface $commandBus
108108
) {}
109109

110110
public function handle(ServerRequestInterface $request): ResponseInterface
@@ -137,7 +137,7 @@ class ExampleRequestHandlerFactory implements FactoryInterface
137137
array $options = null
138138
): ExampleRequestHandler {
139139
return new ExampleRequestHandler(
140-
$container->get(CmdBusInterface::class) // Uses CmdBusFactory internally
140+
$container->get(CommandBusInterface::class) // Uses CommandBusFactory internally
141141
);
142142
}
143143
}
@@ -149,7 +149,7 @@ class ExampleRequestHandlerFactory implements FactoryInterface
149149
class UserService
150150
{
151151
public function __construct(
152-
private CmdBusInterface $commandBus
152+
private CommandBusInterface $commandBus
153153
) {}
154154

155155
public function createUser(array $userData): User
@@ -228,10 +228,10 @@ Always inject the interface rather than the concrete class:
228228

229229
```php
230230
// ✅ Good - depends on interface
231-
public function __construct(private CmdBusInterface $commandBus) {}
231+
public function __construct(private CommandBusInterface $commandBus) {}
232232

233233
// ❌ Bad - depends on implementation
234-
public function __construct(private CmdBus $commandBus) {}
234+
public function __construct(private CommandBus $commandBus) {}
235235
```
236236

237237
### 2. Configure All Dependencies
@@ -241,7 +241,7 @@ Ensure all middleware and handlers have proper factories:
241241
```php
242242
'dependencies' => [
243243
'factories' => [
244-
CmdBus::class => CmdBusFactory::class,
244+
CommandBus::class => CommandBusFactory::class,
245245
MiddlewarePipe::class => MiddlewarePipeFactory::class,
246246
CommandHandlerMiddleware::class => CommandHandlerMiddlewareFactory::class,
247247
// Your custom services...
@@ -252,7 +252,7 @@ Ensure all middleware and handlers have proper factories:
252252

253253
## Related Components
254254

255-
- [CmdBus](../cmdbus.md) - The service this factory creates
255+
- [CommandBus](../CommandBus.md) - The service this factory creates
256256
- [MiddlewarePipeFactory](middleware-pipe-factory.md) - Factory for the required middleware pipeline
257257
- [ConfigProvider](../config-provider.md) - Registers this factory
258258
- [ServiceNotFoundException](../exception/service-not-found-exception.md) - Exception thrown for missing dependencies

docs/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A comprehensive guide to using the cmd-bus Command Bus library in your Mezzio ap
55
## Installation
66

77
```bash
8-
composer require php-cmd/cmd-bus
8+
composer require webware/command-bus
99
```
1010

1111
## Quick Setup
@@ -110,14 +110,14 @@ return [
110110
// src/User/RequestHandler/CreateUserHandler.php
111111
namespace App\User\RequestHandler;
112112

113-
use Webware\CommandBus\CmdBusInterface;
113+
use Webware\CommandBus\CommandBusInterface;
114114
use Laminas\Diactoros\Response\JsonResponse;
115115

116116
// Note that this is a request handler, not a command handler
117117
class CreateUserHandler
118118
{
119119
public function __construct(
120-
private CmdBusInterface $commandBus
120+
private CommandBusInterface $commandBus
121121
) {}
122122

123123
public function handle(ServerRequestInterface $request): ResponseInterface

0 commit comments

Comments
 (0)