{"id":15827825,"url":"https://github.com/joubertredrat/entity-datetime","last_synced_at":"2025-03-15T04:31:16.467Z","repository":{"id":62534364,"uuid":"137819471","full_name":"joubertredrat/entity-datetime","owner":"joubertredrat","description":"Trait for easy manage useful datetime in Doctrine and other entities","archived":false,"fork":false,"pushed_at":"2019-10-14T21:21:24.000Z","size":24,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-23T09:23:49.839Z","etag":null,"topics":["doctrine-orm","php-datetime","php-library","php-traits","php7"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/redrat/entity-datetime","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/joubertredrat.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":"2018-06-19T00:06:47.000Z","updated_at":"2020-07-08T20:54:44.000Z","dependencies_parsed_at":"2022-11-02T16:01:01.283Z","dependency_job_id":null,"html_url":"https://github.com/joubertredrat/entity-datetime","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joubertredrat%2Fentity-datetime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joubertredrat%2Fentity-datetime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joubertredrat%2Fentity-datetime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joubertredrat%2Fentity-datetime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joubertredrat","download_url":"https://codeload.github.com/joubertredrat/entity-datetime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685506,"owners_count":20330980,"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":["doctrine-orm","php-datetime","php-library","php-traits","php7"],"created_at":"2024-10-05T10:09:33.275Z","updated_at":"2025-03-15T04:31:16.202Z","avatar_url":"https://github.com/joubertredrat.png","language":"PHP","readme":"# Entity datetime\n\n[![Build Status](https://travis-ci.org/joubertredrat/entity-datetime.svg?branch=master)](https://travis-ci.org/joubertredrat/entity-datetime)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/joubertredrat/entity-datetime/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/joubertredrat/entity-datetime/?branch=master)\n[![Build Status](https://scrutinizer-ci.com/g/joubertredrat/entity-datetime/badges/build.png?b=master)](https://scrutinizer-ci.com/g/joubertredrat/entity-datetime/build-status/master)\n[![Code Coverage](https://scrutinizer-ci.com/g/joubertredrat/entity-datetime/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/joubertredrat/entity-datetime/?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/redrat/entity-datetime/v/stable)](https://packagist.org/packages/redrat/entity-datetime)\n[![Total Downloads](https://poser.pugx.org/redrat/entity-datetime/downloads)](https://packagist.org/packages/redrat/entity-datetime)\n[![License](https://poser.pugx.org/redrat/entity-datetime/license)](https://packagist.org/packages/redrat/entity-datetime)\n\nTrait for easy manage useful datetime in entities.\n\n#### Install\n\nInstall by composer\n\n```\ncomposer require redrat/entity-datetime\n```\n\n#### Usage\n\n##### With Doctrine\n\n1 - Add trait in your Entity\n\n```php\n\u003c?php\n\nuse RedRat\\Entity\\DateTimeTrait;\n\nclass Foo\n{\n    use DateTimeTrait;\n}\n```\n\n2 - Set `lifecycleCallbacks` in your Doctrine configuration, like example below:\n\n```yaml\n    fields:\n        createdAt:\n            type: datetime\n        updatedAt:\n            type: datetime\n            nullable: true\n            \n    lifecycleCallbacks:\n        prePersist: [ forgeCreatedAt ]\n        preUpdate: [ forgeUpdatedAt ]\n```\n\nNote: More about lifecycle callbacks in Doctrine [documentation](https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/events.html#lifecycle-callbacks).\n\n#### TODO\n\n* API documentation.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoubertredrat%2Fentity-datetime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoubertredrat%2Fentity-datetime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoubertredrat%2Fentity-datetime/lists"}