{"id":22496982,"url":"https://github.com/morebec/orkestra-datetime","last_synced_at":"2025-03-27T21:25:19.122Z","repository":{"id":49499930,"uuid":"359991101","full_name":"Morebec/orkestra-datetime","owner":"Morebec","description":"[READ ONLY] Extension of CakePHP/Chronos that adds utility functions around DateTime manipulation.","archived":false,"fork":false,"pushed_at":"2023-03-31T18:45:53.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"2.x","last_synced_at":"2025-03-02T06:49:09.680Z","etag":null,"topics":["chronos","datetime","orkestra","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Morebec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-21T00:52:27.000Z","updated_at":"2022-07-25T15:51:22.000Z","dependencies_parsed_at":"2024-12-06T20:15:16.750Z","dependency_job_id":"1e8f9783-b6c6-4d5e-8c01-edbf5fdf12c5","html_url":"https://github.com/Morebec/orkestra-datetime","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"0a48948dc865b73401d67ca113f359aa7a437972"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morebec%2Forkestra-datetime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morebec%2Forkestra-datetime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morebec%2Forkestra-datetime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morebec%2Forkestra-datetime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Morebec","download_url":"https://codeload.github.com/Morebec/orkestra-datetime/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245925715,"owners_count":20694948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chronos","datetime","orkestra","php"],"created_at":"2024-12-06T20:15:07.744Z","updated_at":"2025-03-27T21:25:19.090Z","avatar_url":"https://github.com/Morebec.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DateTime\nThe Orkestra DateTime Component builds on top of [cakephp/chronos](https://github.com/cakephp/chronos) which itself builds on top of\n[nesbot/carbon](https://github.com/nesbot/carbon) in order to bring immutability to dates and times as the default.\nIt provides the concept of a `ClockInterface` to be used in projects to get the time as an infrastructure concern\ninstead of directly accessing time as well as providing Date(Time)Range implementations.\n\n## Installation\n\n```shell\ncomposer require morebec/orkestra-orkestra-datetime\n```\n\nThen ensure the composer autoloader is imported:\n```php\n\u003c?php\nrequire 'vendor/autoload.php';\n\nuse Morebec\\Orkestra\\DateTime\\ClockInterface;\nuse Morebec\\Orkestra\\DateTime\\SystemClock;\n\n/** @var ClockInterface $clock */\n$clock = new SystemClock();\nprintf(\"Now: %s\", $clock-\u003enow());\n```\n\n## Usage\n### `ClockInterface`\nThe clock interface is used in order to centralize the location where the current date/time is fetched.\nIn essence, doing things like `DateTime::now()` in arbitrary locations of the code makes it harder to test, and manipulate.\nBeing an infrastructure related concept, it makes more sense to obtain the time from a Clock than being able to access \nit from anywhere.\n\nThis can allow to test the system in the past or future.\n\nHere are the implementations of the `ClockInterface`:\n- `SystemClock` Implementation of the system clock based on the time of the system.\n- `FixedClock` Implementation of clock always returning the same fixed date time, to be used in unit tests for better control of time.\n- `OffsetClock`  Clock that returns the date time from a specific defined offset at creation as if it were the current time. This is useful when we have to reverse in time or fast-forward in the future but still keep the clock running as  the actual time passes.\n\n\nFor more information on the available functions of `Date` and `DateTime`, please refer to the documentation of [cakephp/chronos](https://github.com/cakephp/chronos).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorebec%2Forkestra-datetime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorebec%2Forkestra-datetime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorebec%2Forkestra-datetime/lists"}