{"id":14036795,"url":"https://github.com/davemorrissey/sunrise-sunset-map","last_synced_at":"2025-07-25T21:02:28.640Z","repository":{"id":25908398,"uuid":"90397675","full_name":"davemorrissey/sunrise-sunset-map","owner":"davemorrissey","description":"PHP and ReactJS sunrise/sunset calculator. Source code for sunrisesunsetmap.com.","archived":false,"fork":false,"pushed_at":"2023-01-03T23:17:58.000Z","size":8255,"stargazers_count":10,"open_issues_count":18,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T16:36:14.410Z","etag":null,"topics":["moon-phase","php","reactjs","sunrise","sunrise-sunset","sunset","website"],"latest_commit_sha":null,"homepage":"https://sunrisesunsetmap.com","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davemorrissey.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":"2017-05-05T16:50:44.000Z","updated_at":"2024-02-17T02:10:16.000Z","dependencies_parsed_at":"2022-09-04T07:32:11.260Z","dependency_job_id":null,"html_url":"https://github.com/davemorrissey/sunrise-sunset-map","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davemorrissey/sunrise-sunset-map","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemorrissey%2Fsunrise-sunset-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemorrissey%2Fsunrise-sunset-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemorrissey%2Fsunrise-sunset-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemorrissey%2Fsunrise-sunset-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davemorrissey","download_url":"https://codeload.github.com/davemorrissey/sunrise-sunset-map/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemorrissey%2Fsunrise-sunset-map/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267061734,"owners_count":24029525,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["moon-phase","php","reactjs","sunrise","sunrise-sunset","sunset","website"],"created_at":"2024-08-12T03:02:14.133Z","updated_at":"2025-07-25T21:02:28.281Z","avatar_url":"https://github.com/davemorrissey.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# sunrisesunsetmap.com\n\nThis is the source code for [sunrisesunsetmap.com](https://sunrisesunsetmap.com).\n\nThis site was originally built in 2005, pre-dating even jQuery, when IE6 was the dominant browser.\nIt was intended to run on cheap shared hosting.\n\nI have left it alone until recently but have now rebuilt it to modern standards, using ReactJS\nand SCSS and replacing the location database and automatic timezone code with Google APIs.\n\n### Screenshots\n\n![Desktop](docs/desktop.png)\n\n![Mobile](docs/mobile.png)\n\n### Calculations\n\nPHP has built in sunrise/sunset calculation but this site uses its own, thanks to a long history of\nbeing re-written from JavaScript to Java to PHP, with customisations for better time zone support, solar\ntransit, position calculation etc. The original is in the public domain, used with the kind permission of the\nNOAA, and can be found [here](https://www.esrl.noaa.gov/gmd/grad/solcalc/sunrise.html).\n\nI have lost the source of the moon calculations but believe they were also public domain.\n\n### Recent changes\n\n* Mobile support\n* Geolocation\n* React\n* Webpack\n* Replaced database of places with Google Geocoding API\n* Prefer time zone selection using Google Time Zone API\n* Use composer for TCPDF dependency\n* Flag sprites\n* SCSS\n* SCSS Lint\n* Docker support\n* Heroku support\n\n### Next steps\n\n* Tests\n\nFor better performance and a cleaner deployment the APIs could be separated from the front end, with the APIs\nrun from any PaaS service and the front end hosted on a CDN. The site doesn't have enough traffic to justify\nthe cost and complexity involved.\n\n### Requirements\n\n* Node \u003e= 8\n* PHP \u003e ~5.5, Composer (optional if using Docker on Mac)\n* Docker (recommended on Mac)\n\n### Running locally\n\nThe `react-scripts` project is used together with a SASS compiler to run the app during development. These watch for\nand compile changes to the JS and CSS then apply changes in the browser.\n\nTo start the development server:\n\n    cd app\n    npm install\n    npm start\n\nNow browse to `http://localhost:3000`. The app should run but the React server cannot serve PHP APIs.\n\nYou can set up a local nginx or Apache server with PHP, but if you're using a Mac the easiest approach is to use the\nincluded docker wrapper. This serves the PHP API requests itself, and proxies the app requests through to `localhost:3000`,\ngiving a fully working app. It also runs `composer install` in the container, so you will not need PHP or Composer\ninstalled locally.\n\n**This will only work on a Mac.**\n\n    docker/dev/run.sh\n\nNow browse to `http://localhost:8000` or `https://localhost:8443`.\n\n### Deploying with Docker\n\nA Dockerfile and build/run script can be found in `docker/prod`, along with instructions. These create a self contained\nDocker image that can be deployed to a container hosting service. You will need Docker, PHP, Node and Composer installed\nin your build environment to build this image.\n\n### Deploying to Heroku\n\nThe app can be deployed on Heroku without using Docker. Two Heroku buildpacks are required - PHP to serve the APIs and\ngenerate PDFs, and Node (at deployment time only) to generate the static site.\n\n* Add the app to Heroku: `heroku create your-app-name`\n* In the Heroku console, add the PHP and Node buildpacks\n* In the Heroku console, add a config var: `API_KEY=\u003cyour-google-api-key\u003e`\n* You should also change the Google API key in `.env`\n* Deploy the app: `git push heroku master`\n\n### Deploying to a VPS\n\nTo minimise hosting costs for several low traffic sites, I run this app on a simple VPS setup with nginx and PHP-FPM.\nThe `zip.sh` script creates a zip file that can be copied to and extracted on a remote server.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavemorrissey%2Fsunrise-sunset-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavemorrissey%2Fsunrise-sunset-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavemorrissey%2Fsunrise-sunset-map/lists"}