rikudou / clock-bundle
Simple Symfony bundle for clock abstraction
Installs: 166
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.0
- rikudou/clock: ^1.0
- symfony/config: ^4.3 | ^5.0
- symfony/dependency-injection: ^4.3 | ^5.0
- symfony/http-kernel: ^4.3 | ^5.0
- symfony/yaml: ^4.3 | ^5.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
This package is auto-updated.
Last update: 2024-11-06 02:28:30 UTC
README
Simple Symfony bundle I wrote because I'm tired of writing it all the time for each project where I need current time.
Feel free to use it.
Installation
composer require rikudou/clock-bundle
Usage
- Typehint the
\Rikudou\Clock\ClockInterface
as your dependency - You can now easily test your time dependent functions
- ???
- Profit
Services:
rikudou.clock.clock
- standard DateTime classrikudou.clock.immutable
- DateTimeImmutablerikudou.clock.fixed_timezone
- DateTime with specified timezonerikudou.clock.fixed_timezone_immutable
- DateTimeImmutable with specified timezonerikudou.clock.default
- the implementation configured as defaultRikudou\Clock\ClockInterface
- alias torikudou.clock.default
, autowiring supported
Configuration
Generated automatically via php bin/console config:dump rikudou_clock > config/packages/rikudou_clock.yaml
# Default configuration for extension with alias: "rikudou_clock" rikudou_clock: # The clock that will be used as default when injecting interface default_clock: rikudou.clock.clock # One of "rikudou.clock.clock"; "rikudou.clock.immutable"; "rikudou.clock.fixed_timezone"; "rikudou.clock.fixed_timezone_immutable" # The timezone used for timezoned clocks timezone: UTC