Giter VIP home page Giter VIP logo

sun's Introduction

Get information on the position of the sun

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This package can determine several things on the position of the sun.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We 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. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require spatie/sun

Usage

When instantiating Spatie\Sun\Sun you should pass it coordinates.

$coordinatesOfAntwerp = ['lat' => 51.260197, 'lng' => 4.402771];

$sun = new Sun($coordinatesOfAntwerp['lat'], $coordinatesOfAntwerp['lng']);

Get the time of sunrise

You can get the time of the sunrise.

$sun->sunrise(); // returns an instance of \Carbon\Carbon

You can get the time of the sunrise on a specific date by passing in instance of Carbon\Carbon to sunrise

$sun->sunrise($carbon); // returns an instance of \Carbon\Carbon

Get the time of zenith

You can get the time of the zenith.

$sun->zenith(); // returns an instance of \Carbon\Carbon

You can get the time of the zenith on a specific date by passing in instance of Carbon\Carbon to zenith

$sun->zenith($carbon); // returns an instance of \Carbon\Carbon

Get the time of sunset

You can get the time of the sunset.

$sun->sunset(); // returns an instance of \Carbon\Carbon

You can get the time of the sunset on a specific date by passing in instance of Carbon\Carbon to sunset

$sun->sunset($carbon); // returns an instance of \Carbon\Carbon

Determine if the sun is up

This is how you can determine if the sun is up:

$sun->sunIsUp(); // returns a boolean

You can get determine if the sun is up at a specific moment by passing in instance of Carbon\Carbon to sunIsUp

$sun->sunIsUp($carbon); // returns a boolean

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

sun's People

Contributors

adrianmrn avatar freekmurze avatar gummibeer avatar lukasss93 avatar masterodin avatar nunomaduro avatar patinthehat avatar riasvdv avatar willemvb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sun's Issues

Wrong link in description

Repository description is with wrong link to Spatie website.

Wrong: https://spatie/open-source
Correct: https://spatie.be/open-source

Remove the dependence on carbon

Not every developer needs carbon. It is an overhead that could be avoided. Possibly. you could also offer a factory that returns \DateTime or \Carbon instance depending on the configuration.

`sunIsUp()` for given date

According to the readme

You can get determine if the sun is up at a specific moment by passing in instance of Carbon\Carbon to sunIsUp

But in the code, this function only checks if the current date Carbon::now() is between the sunrise and sunset of the passed date

It should check if the passed date is between that days sunrise/sunset, shouldn't it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.