Skip to content

Commit 55b475d

Browse files
committed
feat: add ClockServiceProvider integration to FrameworkServiceProvider and update documentation
Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
1 parent 3522ac4 commit 55b475d

File tree

6 files changed

+33
-16
lines changed

6 files changed

+33
-16
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
},
1717
"require": {
1818
"php": "^8.3",
19+
"fast-forward/clock": "^1.0",
1920
"fast-forward/config": "^1.4",
2021
"fast-forward/container": "^1.5",
2122
"fast-forward/defer": "^1.0",

docs/api/service-map.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ Framework-level classes and providers
3232
* - ``FastForward\EventDispatcher\EventDispatcher``
3333
- ``fast-forward/event-dispatcher``
3434
- Concrete dispatcher implementation behind the PSR-14 and Symfony contracts interfaces
35+
* - ``FastForward\Clock\ServiceProvider\ClockServiceProvider``
36+
- ``fast-forward/clock``
37+
- Registers the PSR-20 clock, a system clock implementation, and timezone factory
3538

3639
Installed entry points outside the framework provider
3740
-----------------------------------------------------

docs/api/service-provider.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ FrameworkServiceProvider
44
.. php:class:: FastForward\Framework\ServiceProvider\FrameworkServiceProvider
55
66
Aggregates the default Fast Forward framework providers into a single container entry point.
7-
In the current package, it composes the HTTP stack and the event-dispatcher stack by delegating
8-
to ``FastForward\Http\ServiceProvider\HttpServiceProvider`` and
9-
``FastForward\EventDispatcher\ServiceProvider\EventDispatcherServiceProvider``.
7+
In the current package, it composes the HTTP stack, the event-dispatcher stack, and the clock utilities
8+
by delegating to ``FastForward\Http\ServiceProvider\HttpServiceProvider``,
9+
``FastForward\EventDispatcher\ServiceProvider\EventDispatcherServiceProvider``, and
10+
``FastForward\Clock\ServiceProvider\ClockServiceProvider``.
1011

1112
The class extends ``FastForward\Container\ServiceProvider\AggregateServiceProvider``,
1213
so it inherits the provider-merging behavior used across the ecosystem.
@@ -28,6 +29,8 @@ What it aggregates
2829
- Through that provider, the HTTP message factories and HTTP client service providers
2930
- ``FastForward\EventDispatcher\ServiceProvider\EventDispatcherServiceProvider``
3031
- Through that provider, the PSR-14 dispatcher, Symfony contracts dispatcher alias, and listener-provider services
32+
- ``FastForward\Clock\ServiceProvider\ClockServiceProvider``
33+
- Through that provider, the PSR-20 clock, a system clock implementation, and timezone factory
3134

3235
Important behavior inherited from ``AggregateServiceProvider``
3336
--------------------------------------------------------------
@@ -48,7 +51,12 @@ Constructor
4851
Current scope
4952
-------------
5053

51-
Although the metapackage installs multiple libraries, this local service provider currently wires
52-
the HTTP and event-dispatcher stacks only. Packages such as ``fast-forward/config``,
53-
``fast-forward/defer``, ``fast-forward/fork``, and ``fast-forward/iterators`` remain available
54-
through Composer autoloading and can be introduced into your application as needed.
54+
The framework provider wires three main stacks:
55+
56+
- HTTP (via ``HttpServiceProvider``)
57+
- Event-dispatching (via ``EventDispatcherServiceProvider``)
58+
- Clock/time utilities (via ``ClockServiceProvider``)
59+
60+
Packages such as ``fast-forward/config``, ``fast-forward/defer``, ``fast-forward/fork``, and
61+
``fast-forward/iterators`` remain available through Composer autoloading and can be introduced
62+
into your application as needed.

grumphp.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/ServiceProvider/FrameworkServiceProvider.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,29 @@
1818

1919
namespace FastForward\Framework\ServiceProvider;
2020

21+
use FastForward\Clock\ServiceProvider\ClockServiceProvider;
2122
use FastForward\Container\ServiceProvider\AggregateServiceProvider;
2223
use FastForward\EventDispatcher\ServiceProvider\EventDispatcherServiceProvider;
2324
use FastForward\Http\ServiceProvider\HttpServiceProvider;
2425

2526
/**
26-
* Class FrameworkServiceProvider.
27-
*
2827
* Aggregates core framework service providers into a unified service provider.
28+
*
2929
* This class MUST be used to encapsulate all foundational service providers
3030
* required to initialize the application container.
3131
*
32-
* The current aggregation includes:
33-
* - {@see HttpServiceProvider} for the HTTP stack
34-
* - {@see EventDispatcherServiceProvider} for PSR-14 and Symfony-compatible event dispatching
35-
*
3632
* This class SHALL implement the ServiceProviderInterface and MUST delegate
3733
* its service discovery responsibilities to an internal AggregateServiceProvider.
34+
*
35+
* @see AggregateServiceProvider for composing multiple service providers into one
36+
* @see HttpServiceProvider for HTTP handling and middleware support
37+
* @see EventDispatcherServiceProvider for PSR-14 and Symfony-compatible event dispatching
38+
* @see ClockServiceProvider for time and scheduling utilities
3839
*/
3940
final class FrameworkServiceProvider extends AggregateServiceProvider
4041
{
4142
/**
42-
* Constructs the FrameworkServiceProvider.
43+
* Creates a new FrameworkServiceProvider instance.
4344
*
4445
* This constructor MUST initialize the aggregate service provider using
4546
* a composition of essential framework service providers.
@@ -49,6 +50,7 @@ public function __construct()
4950
parent::__construct(
5051
new HttpServiceProvider(),
5152
new EventDispatcherServiceProvider(),
53+
new ClockServiceProvider(),
5254
);
5355
}
5456
}

tests/ServiceProvider/FrameworkServiceProviderTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
namespace FastForward\Framework\Tests\ServiceProvider;
2020

21+
use FastForward\Clock\ServiceProvider\ClockServiceProvider;
2122
use FastForward\Container\Factory\ServiceFactory;
2223
use FastForward\EventDispatcher\ServiceProvider\EventDispatcherServiceProvider;
2324
use FastForward\Framework\ServiceProvider\FrameworkServiceProvider;
@@ -47,12 +48,15 @@ public function getFactoriesWillReturnAggregatedServiceProviderFactories(): void
4748
{
4849
$eventDispatcherServiceProvider = new EventDispatcherServiceProvider();
4950
$httpServiceProvider = new HttpServiceProvider();
51+
$clockServiceProvider = new ClockServiceProvider();
5052

5153
$expectedFactories = array_merge(
5254
$httpServiceProvider->getFactories(),
5355
$eventDispatcherServiceProvider->getFactories(),
56+
$clockServiceProvider->getFactories(),
5457
[
5558
EventDispatcherServiceProvider::class => new ServiceFactory($eventDispatcherServiceProvider),
59+
ClockServiceProvider::class => new ServiceFactory(new ClockServiceProvider()),
5660
FrameworkServiceProvider::class => new ServiceFactory($this->provider),
5761
]
5862
);
@@ -76,6 +80,7 @@ public function getExtensionsWillReturnAggregatedServiceProviderExtensions(): vo
7680
$expectedExtensions = array_merge(
7781
(new HttpServiceProvider())->getExtensions(),
7882
(new EventDispatcherServiceProvider())->getExtensions(),
83+
(new ClockServiceProvider())->getExtensions(),
7984
);
8085

8186
$actualExtensions = $this->provider->getExtensions();

0 commit comments

Comments
 (0)