{"id":19324903,"url":"https://github.com/spatie/sun","last_synced_at":"2025-04-12T17:42:33.813Z","repository":{"id":46025824,"uuid":"258156568","full_name":"spatie/sun","owner":"spatie","description":"Get information on the position of the sun","archived":false,"fork":false,"pushed_at":"2025-02-21T13:25:37.000Z","size":47,"stargazers_count":71,"open_issues_count":0,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-03T19:16:01.560Z","etag":null,"topics":["geo","php","sun"],"latest_commit_sha":null,"homepage":"https://spatie.be/open-source","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/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"spatie","custom":"https://spatie.be/open-source/support-us"}},"created_at":"2020-04-23T09:35:32.000Z","updated_at":"2025-02-21T14:53:54.000Z","dependencies_parsed_at":"2025-02-28T18:13:15.586Z","dependency_job_id":"4cc0192b-e1fc-4abb-9d73-0cc326ac570e","html_url":"https://github.com/spatie/sun","commit_stats":{"total_commits":60,"total_committers":8,"mean_commits":7.5,"dds":0.4,"last_synced_commit":"844421d470af2d21918e38960c76841e63bd694f"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fsun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fsun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fsun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fsun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/sun/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248608371,"owners_count":21132714,"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":["geo","php","sun"],"created_at":"2024-11-10T02:07:29.151Z","updated_at":"2025-04-12T17:42:33.791Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":["https://github.com/sponsors/spatie","https://spatie.be/open-source/support-us"],"categories":[],"sub_categories":[],"readme":"# Get information on the position of the sun\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/sun.svg?style=flat-square)](https://packagist.org/packages/spatie/sun)\n[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/spatie/sun/run-tests?label=tests)](https://github.com/spatie/sun/actions?query=workflow%3Arun-tests+branch%3Amaster)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/sun.svg?style=flat-square)](https://packagist.org/packages/spatie/sun)\n\nThis package can determine several things on the position of the sun.\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/sun.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/sun)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require spatie/sun\n```\n\n## Usage\n\nWhen instantiating `Spatie\\Sun\\Sun` you should pass it coordinates.\n\n```php\n$coordinatesOfAntwerp = ['lat' =\u003e 51.260197, 'lng' =\u003e 4.402771];\n\n$sun = new Sun($coordinatesOfAntwerp['lat'], $coordinatesOfAntwerp['lng']);\n```\n\n### Get the time of sunrise\n\nYou can get the time of the sunrise.\n\n```php\n$sun-\u003esunrise(); // returns an instance of \\Carbon\\Carbon\n```\n\nYou can get the time of the sunrise on a specific date by passing in instance of `Carbon\\Carbon` to `sunrise`\n\n```php\n$sun-\u003esunrise($carbon); // returns an instance of \\Carbon\\Carbon\n```\n\n### Get the time of zenith\n\nYou can get the time of the zenith.\n\n```php\n$sun-\u003ezenith(); // returns an instance of \\Carbon\\Carbon\n```\n\nYou can get the time of the zenith on a specific date by passing in instance of `Carbon\\Carbon` to `zenith`\n\n```php\n$sun-\u003ezenith($carbon); // returns an instance of \\Carbon\\Carbon\n```\n\n### Get the time of sunset\n\nYou can get the time of the sunset.\n\n```php\n$sun-\u003esunset(); // returns an instance of \\Carbon\\Carbon\n```\n\nYou can get the time of the sunset on a specific date by passing in instance of `Carbon\\Carbon` to `sunset`\n\n```php\n$sun-\u003esunset($carbon); // returns an instance of \\Carbon\\Carbon\n```\n\n### Determine if the sun is up\n\nThis is how you can determine if the sun is up:\n\n```php\n$sun-\u003esunIsUp(); // returns a boolean\n```\n\n\nYou can get determine if the sun is up at a specific moment by passing in instance of `Carbon\\Carbon` to `sunIsUp`\n\n```php\n$sun-\u003esunIsUp($carbon); // returns a boolean\n```\n\n## Testing\n\n``` bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security\n\nIf you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker.\n\n## Credits\n\n- [Freek Van der Herten](https://github.com/freekmurze)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Fsun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Fsun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Fsun/lists"}