{"id":15916866,"url":"https://github.com/e-commit/frequency-generator","last_synced_at":"2026-02-12T09:32:56.001Z","repository":{"id":56974778,"uuid":"66199993","full_name":"e-commit/frequency-generator","owner":"e-commit","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-15T12:58:47.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-29T11:47:11.425Z","etag":null,"topics":["frequency","frequency-generator","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/e-commit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2016-08-21T13:23:36.000Z","updated_at":"2025-03-15T12:58:50.000Z","dependencies_parsed_at":"2023-02-08T05:45:50.735Z","dependency_job_id":"905f983c-dcba-4ead-ac44-3dd7f562afe9","html_url":"https://github.com/e-commit/frequency-generator","commit_stats":{"total_commits":44,"total_committers":1,"mean_commits":44.0,"dds":0.0,"last_synced_commit":"e8d1c45dcc5b9a4ca350b3150648e0ecc737ea6b"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/e-commit/frequency-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-commit%2Ffrequency-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-commit%2Ffrequency-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-commit%2Ffrequency-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-commit%2Ffrequency-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/e-commit","download_url":"https://codeload.github.com/e-commit/frequency-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-commit%2Ffrequency-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29362822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["frequency","frequency-generator","php"],"created_at":"2024-10-06T18:05:54.724Z","updated_at":"2026-02-12T09:32:55.980Z","avatar_url":"https://github.com/e-commit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Frequency generator\n\nGet the next date (DateTime object) by frequency.\n\n![Tests](https://github.com/e-commit/frequency-generator/workflows/Tests/badge.svg)\n\n## Installation ##\n\nTo install frequency-generator with Composer just run :\n\n```bash\n$ composer require ecommit/frequency-generator\n```\n\n## Usage ##\n\n### Create generator ###\n\n```php\nuse Ecommit\\FrequencyGenerator\\FrequencyGenerator;\n\n$generator = new FrequencyGenerator();\n```\n\n### Frequency \"every day\" ###\n\n```php\n//Every day at 08:00:00 and 10:00:00\n$dateTimeObject = $generator-\u003enextInEveryDay([new \\DateTime('10:00:00'), new \\DateTime('08:00:00')]);\n```\n\nArguments :\n* **array $times** Times (Array of DateTime or DateTimeImmutable objects). Default: only *00:00:00*\n\n\n### Frequency \"every week\" ###\n\n```php\n//Every monday (at 08:00:00 and 10:00:00) and tuesday (at 08:00:00 and 10:00:00)\n$dateTimeObject = $generator-\u003enextInEveryWeek([1, 2], [new \\DateTime('10:00:00'), new \\DateTime('08:00:00')]);\n```\n\nArguments :\n* **array $days** Array of days in week (integers). (1=Monday =\u003e 7=Sunday). Default: Only *1* (monday)\n* **array $times** Times (Array of DateTime or DateTimeImmutable objects). Default: only *00:00:00*\n\n\n### Frequency \"every month\" ###\n\n```php\n//Every 1st (at 08:00:00 and 10:00:00) and 2nd (at 08:00:00 and 10:00:00)\n$dateTimeObject = $generator-\u003enextInEveryMonth([1, 2], [new \\DateTime('10:00:00'), new \\DateTime('08:00:00')]);\n```\n\nArguments :\n* **array $days** Array of days in month (integers). (1=\u003e31). Default: Only *1* (1st)\n* **array $times** Times (Array of DateTime or DateTimeImmutable objects). Default: only *00:00:00*\n\n\n### Frequency \"every quart\" ###\n\n```php\n//Every 1st and 15th February, May, August and November (at 08:00:00 and 10:00:00)  \n$dateTimeObject = $generator-\u003enextInEveryQuart([2], [1, 15], [new \\DateTime('10:00:00'), new \\DateTime('08:00:00')]);\n```\n\nArguments :\n* **array $monthOffsets** Array of month offsets in quart (integers). (1 = January, April, July, October. 2 = February, May, August, November. 3 = March, June, September, December). Default: Only *1* (January, April, July, October)\n* **array $daysInMonth** Array of days in month (integers). (1=\u003e31). Default: Only *1* (1st)\n* **array $times** Times (Array of DateTime or DateTimeImmutable objects). Default: only *00:00:00*\n\n\n### Frequency \"every half year\" ###\n\n```php\n//Every 1st and 15th February and August (at 08:00:00 and 10:00:00)  \n$dateTimeObject = $generator-\u003enextInEveryHalfYear([2], [1, 15], [new \\DateTime('10:00:00'), new \\DateTime('08:00:00')]);\n```\n\n\n* **array $monthOffsets** Array of month offsets in half year (integers). 1 = January, July. 2 = February, August. 3 = March, September. 4 = April, October. 5 = May , November. 6 = June, December). Default: Only *1* (January, July)\n* **array $daysInMonth** Array of days in month (integers). (1=\u003e31). Default: Only *1* (1st)\n* **array $times** Times (Array of DateTime or DateTimeImmutable objects). Default: only *00:00:00*\n\n\n### Frequency \"every year\" ###\n\n```php\n//Every 1st and 15th January (at 08:00:00 and 10:00:00)  \n$dateTimeObject = $generator-\u003enextInEveryYear([1], [1, 15], [new \\DateTime('10:00:00'), new \\DateTime('08:00:00')]);\n```\n\n\n* **array $monthOffsets** Array of month offsets in year (integers). (1 = January =\u003e 12 =\u003e December). Default: Only *1* (January)\n* **array $daysInMonth** Array of days in month (integers). (1=\u003e31). Default: Only *1* (1st)\n* **array $times** Times (Array of DateTime or DateTimeImmutable objects). Default: only *00:00:00*\n\n\n## Generate DateTimeImmutable objects ##\n\nThe generator generates by default DateTime objects.\n\nThe generator can generate DateTimeImmutable objets with `generateDateTimeImmutable` method: \n\n```php\nuse Ecommit\\FrequencyGenerator\\FrequencyGenerator;\n\n$generator = new FrequencyGenerator();\n\n$date = $generator-\u003enextInEveryDay([new \\DateTime('10:00:00'), new \\DateTime('08:00:00')]);\necho get_class($date); //This example will output \"DateTime\"\n\n$generator-\u003egenerateDateTimeImmutable(true);\n$date = $generator-\u003enextInEveryDay([new \\DateTime('10:00:00'), new \\DateTime('08:00:00')]);\necho get_class($date); //This example will output \"DateTimeImmutable\"\n\n$generator-\u003egenerateDateTimeImmutable(false);\n$date = $generator-\u003enextInEveryDay([new \\DateTime('10:00:00'), new \\DateTime('08:00:00')]);\necho get_class($date); //This example will output \"DateTime\"\n```\n\n\n## License ##\n\nThis librairy is under the MIT license. See the complete license in *LICENSE* file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe-commit%2Ffrequency-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fe-commit%2Ffrequency-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe-commit%2Ffrequency-generator/lists"}