https://github.com/effectra/clock
This is a PHP class named `Clock` that implements the `Psr\Clock\Clock` interface. It provides a simple and standard way to retrieve the current time and timestamp in PHP applications.
https://github.com/effectra/clock
clock php psr
Last synced: 9 months ago
JSON representation
This is a PHP class named `Clock` that implements the `Psr\Clock\Clock` interface. It provides a simple and standard way to retrieve the current time and timestamp in PHP applications.
- Host: GitHub
- URL: https://github.com/effectra/clock
- Owner: effectra
- Created: 2023-06-19T13:31:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-19T13:36:50.000Z (almost 3 years ago)
- Last Synced: 2025-06-09T19:48:09.248Z (12 months ago)
- Topics: clock, php, psr
- Language: PHP
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Effectra\Clock
This is a PHP class named `Effectra\Clock` that implements the `Psr\Clock\Clock` interface. It provides a simple and standard way to retrieve the current time and timestamp in PHP applications.
## Features
- Implements the `Psr\Clock\ClockInterface` interface
- Provides the `now()` method to retrieve the current time as a `DateTimeImmutable` object
- Offers the `timestamp()` method to retrieve the current timestamp as an integer
## Usage
```php
// Create a new instance of the Clock class
$clock = new \Effectra\Clock\Clock();
// Get the current time as a DateTimeImmutable object
$currentDateTime = $clock->now();
// Get the current timestamp as an integer
$currentTimestamp = $clock->timestamp();
```
## Contributing
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please feel free to submit a pull request or open an issue on the GitHub repository.
## License
This package is open-source and available under the [MIT License](https://opensource.org/licenses/MIT).
"# clock"