{"id":19234527,"url":"https://github.com/phpmentors-jp/domain-commons","last_synced_at":"2025-04-21T05:30:59.338Z","repository":{"id":31210581,"uuid":"34771584","full_name":"phpmentors-jp/domain-commons","owner":"phpmentors-jp","description":null,"archived":false,"fork":false,"pushed_at":"2019-08-08T00:48:22.000Z","size":45,"stargazers_count":11,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T09:52:32.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpmentors-jp.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}},"created_at":"2015-04-29T04:02:36.000Z","updated_at":"2024-05-15T11:03:34.000Z","dependencies_parsed_at":"2022-07-22T04:17:07.981Z","dependency_job_id":null,"html_url":"https://github.com/phpmentors-jp/domain-commons","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpmentors-jp%2Fdomain-commons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpmentors-jp%2Fdomain-commons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpmentors-jp%2Fdomain-commons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpmentors-jp%2Fdomain-commons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpmentors-jp","download_url":"https://codeload.github.com/phpmentors-jp/domain-commons/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250002161,"owners_count":21359061,"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":[],"created_at":"2024-11-09T16:14:12.017Z","updated_at":"2025-04-21T05:30:59.074Z","avatar_url":"https://github.com/phpmentors-jp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Domain Commons\n\nCommons for domain models\n\n[![Build Status](https://travis-ci.org/phpmentors-jp/domain-commons.svg?branch=master)](https://travis-ci.org/phpmentors-jp/domain-commons)\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/0e1c452e-3cd6-4e17-a6c2-77ae78a9a878/mini.png)](https://insight.sensiolabs.com/projects/0e1c452e-3cd6-4e17-a6c2-77ae78a9a878)\n[![Total Downloads](https://poser.pugx.org/phpmentors/domain-commons/downloads.png)](https://packagist.org/packages/phpmentors/domain-commons)\n[![Latest Stable Version](https://poser.pugx.org/phpmentors/domain-commons/v/stable.png)](https://packagist.org/packages/phpmentors/domain-commons)\n[![Latest Unstable Version](https://poser.pugx.org/phpmentors/domain-commons/v/unstable.png)](https://packagist.org/packages/phpmentors/domain-commons)\n\n# Installation\n\n`Domain Commons` can be installed using  [Composer](http://getcomposer.org/).\n\n```\n$ composer require phpmentors/domain-commons\n```\n\n# Features\n\n## DateTime basics\n\n### Date and Time\n\n- Date\n- DateTime\n- MonthDay\n- Year\n- YearMonth\n- HourMin\n- AgeRange\n\n### Period\n\n- Duration\n- Period\n- Term\n\n#### Traversable\n\n- DailyTrait / DailyIteratableInterface\n- MonthlyTrait / MonthlyIteratableInterface\n\nYou can define a domain specific period as follows:\n\n```php\nnamespace MyDomain;\n\nuse PHPMentors\\DomainCommons\\DateTime\\Date;\nuse PHPMentors\\DomainCommons\\DateTime\\Period\\DailyIteratableInterface;\nuse PHPMentors\\DomainCommons\\DateTime\\Period\\DailyTrait;\n\nclass DailyPeriod extends Period implements DailyIteratableInterface\n{\n    use DailyTrait;\n\n    public function __construct(Date $start, Date $end)\n    {\n        parent::__construct($start, $end);\n        $this-\u003eit = $this-\u003eiterate(); // this line enables iterator\n    }\n}\n```\n\nYou can iterate this period by date using standard `foreach` statement as follows:\n\n```\nuse PHPMentors\\DomainCommons\\DateTime\\Date;\nuse MyDomain\\DailyPeriod;\n\n$period = new DailyPeriod(new Date('2015-04-12'), new Date('2015-06-30'));\n\n$count = 0;\nforeach ($period as $one) {\n    echo $one-\u003eformat('m/d') . PHP_EOL;\n}\n```\n\n### Utility\n\n- Clock\n\n## Matrix (Typed and Addressed)\n\n- TypedMatrix\n- AddressedMatrix\n\n### Operation\n\n- ZeroableInterface\n\n## String Utility\n\n- UniqueName\n\n# Support\n\nIf you find a bug or have a question, or want to request a feature, create an issue or pull request for it on [Issues](https://github.com/phpmentors-jp/domain-commons/issues).\n\n# Copyright\n\nCopyright (c) 2015 GOTO Hidenori, 2015 KUBO Atsuhiro, All rights reserved.\n\n# License\n\n[The BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpmentors-jp%2Fdomain-commons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpmentors-jp%2Fdomain-commons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpmentors-jp%2Fdomain-commons/lists"}