Giter Club home page Giter Club logo

aladhan.com's Introduction

بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ

CI GitHub All Releases

Al Adhan App

This is the code you see deployed on https://aladhan.com. This documentation explains how you can get setup to deploy your own instance and contribute code.

Technology Stack and Requirements

  • PHP 8.1
  • Composer - See composer.json for other dependencies
  • Slim Framework v4
  • Bootstrap 3
  • JQuery
  • Docker

Getting Started

Running the App

The app is fully Dockerised. You just need docker to spin it up.

A production ready Docker image of the app is published as:

  • quay.io/islamic-network/aladhan.com on QUAY
  • ghcr.io/islamic-network/aladhan.com on the GitHub Container Registry

To get your own instance up, simply run:

docker run -it -p 8082:8080  ghcr.io/islamic-network/aladhan.com:latest

You can now visit http://localhost:8082/ and start using it.

Build and Contribute

Please note that the Dockerfile included builds a production ready container which has opcache switched on and xdebug turned off, so you will only see your changes every 5 minutes if you are developing. To actively develop, change the FROM ghcr.io/islamic-network/php:8.0-apache line to ghcr.io/islamic-network/php:8.0-apache-dev.

  1. Clone this repository
  2. Run docker build . -t ghcr.io/islamic-network/aladhan.com. This will build an image with production dependencies only.
  3. Run docker run -it -p 8081:8080 -v $(pwd)/.:/var/www ghcr.io/islamic-network/aladhan.com to spin up the built image.
  4. Run composer install to add development dependencies.
  5. Make sure you have internet connectivity so the app can connect to https://api.aladhan.com.
  6. Open your browser and browse to http://localhost:8081/.
  7. Any changes you make will be synced to the Docker container. You just refresh the page in the browser to see them.

Scaling and Sizing

This app takes 37 MB per apache process / worker and is set to have a maximum of 10 Apache workers.

A single instance should be sized with a maximum of 400 MB RAM, after which you should scale it horizontally.

To test against a local running API

Build the container and run:

docker run -p 8080:8080 -v $(pwd)/.:/var/www -e API_BASE_URI=http://host.docker.internal --add-host=host.docker.internal:host-gateway <<containername>>

Contributing Code

You can contribute code by raising a pull request.

There's a backlog of stuff under issues for things that potentially need to be worked on, so please feel free to pick something up from there or contribute your own improvements.

You can also join the community at https://community.islamic.network/ or the Islamic Network Discord Server to discuss any of the apps or APIs @ https://discord.gg/FwUy69M.

aladhan.com's People

Contributors

akhandok avatar dependabot[bot] avatar kh4lidmd avatar meezaan avatar papasmile avatar tarek-adra avatar youssefmoataz 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

Watchers

 avatar  avatar  avatar  avatar

aladhan.com's Issues

Blocked CORS in Chrome Extension

I have a Chrome Extension called Quran In a New Tab and I've been using this API for a while. However, recently all requests are blocked with the following error:

Access to XMLHttpRequest at 'http://api.aladhan.com/v1/hToG?date=27-5-1443' from origin 'chrome-extension://fdhiopcnpihkmbkfagjdibggbaangnjp' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

If it's possible to fix this issue it would be of great help. Thank you.

Prayer times as a calendar-ready CSV

User Story

As an organised person and a praying person, I want my day to be well- planned. I use calendar apps intensively to plan the day, and all my personal and work entries are there. I want to make sure I make enough time for my daily prayers, so I’d like to have them added to my calendar as standard calendar entries. That would also mark me busy for my family and coworkers who check my availability before scheduleing meetings and calls. So I want to have an option to download prayers timetable as a CSV to import it later to my calendar. CSVs should be available with data for a year (for prayers in permanent stay area), a month, a week, and a single day (for long and short trips).

For example, part of the CSV for 1 September 2021 could look like this:

Subject Start Date Start Time
Fajr 01-09-2021 03:29
Sunrise 01-09-2021 05:34
Dhuhr 01-09-2021 12:30
Asr 01-09-2021 16:14
Maghrib 01-09-2021 19:24
Isha 01-09-2021 21:18

aladhan.com blocked from my country (AU)

Assallam,

It seems a few people have this issue, I figured I would report here too. I cannot access aladhan.com from multiple AU IP's but I can access it from a Ukraine IP range fine. Is there some sort of geo blocking occurring now?

This has also affected a few Home Assistant users for the Islamic Prayer times integration which uses the aladhan.com API.

Question: How does the GetTimingsByCity API behave?

Hello 👋🏾 First off I would like thank you all for your efforts in this project. I have a few questions regrading the behavior of the https://aladhan.com/prayer-times-api#GetTimingsByCity API. I'm not sure this is the proper repo to ask tis question so feel free to transfer this issue to the proper location.

  1. What are the supported countries for this API?

  2. For the state field is this analogous to providence for countries like Canada? e.g. If I wanted prayer times for toronto would I provide?city=Toronto&state=Ontario&country= CA ?

  3. If you run a dummy request with invalid country it could guess the closest city with that name? For example using the city Rochester with the country foo returns the following: As you can see below, the data returned is for Rochester, NY, US. Seems like the API uses google geocoding to guess your location? How does it choose Rochester, NY when there are multiple cities named Rochester in the US? Is there a way to disable using geocoding and simply return an error if the city + state + country is invalid?

You can test this by going here: https://api.aladhan.com/v1/timingsByCity?city=Rochester&state=&country=foo

{
  "code":200,
  "status":"OK",
  "data":{
     "timings":{
        "Fajr":"05:43",
        "Sunrise":"07:02",
        "Dhuhr":"12:24",
        "Asr":"15:19",
        "Sunset":"17:47",
        "Maghrib":"17:47",
        "Isha":"19:06",
        "Imsak":"05:33",
        "Midnight":"00:24"
     },
     "date":{
        "readable":"19 Feb 2021",
        "timestamp":"1613790206",
        "hijri":{
           "date":"07-07-1442",
           "format":"DD-MM-YYYY",
           "day":"07",
           "weekday":{
              "en":"Al Juma'a",
              "ar":"\u0627\u0644\u062c\u0645\u0639\u0629"
           },
           "month":{
              "number":7,
              "en":"Rajab",
              "ar":"\u0631\u064e\u062c\u064e\u0628"
           },
           "year":"1442",
           "designation":{
              "abbreviated":"AH",
              "expanded":"Anno Hegirae"
           },
           "holidays":[
              
           ]
        },
        "gregorian":{
           "date":"19-02-2021",
           "format":"DD-MM-YYYY",
           "day":"19",
           "weekday":{
              "en":"Friday"
           },
           "month":{
              "number":2,
              "en":"February"
           },
           "year":"2021",
           "designation":{
              "abbreviated":"AD",
              "expanded":"Anno Domini"
           }
        }
     },
     "meta":{
        "latitude":43.1448135,
        "longitude":-77.5903625,
        "timezone":"America\/New_York",
        "method":{
           "id":2,
           "name":"Islamic Society of North America (ISNA)",
           "params":{
              "Fajr":15,
              "Isha":15
           }
        },
        "latitudeAdjustmentMethod":"ANGLE_BASED",
        "midnightMode":"STANDARD",
        "school":"STANDARD",
        "offset":{
           "Imsak":0,
           "Fajr":0,
           "Sunrise":0,
           "Dhuhr":0,
           "Asr":0,
           "Maghrib":0,
           "Sunset":0,
           "Isha":0,
           "Midnight":0
        }

Stop Endless Retires for Bad Location

Entering a bad location results in endless retires to geocode. It seems that successful geocode calls update timings but error responses do not:

success: function(data) {
// Update timings
gc._timings = data.data.timings;
},
error: function() {
console.log('API threw an error!');
}
});

One solution would be to clear out _location on error and display an error message above location field. Could be annoying for slow typers, though, since we auto-fetch every seven seconds...

Remove dependency on API Code

There is currently a dependency on the HijriCalendarService class in the API. Update the API client and use that instead!

Incorrect "tune" documentation?

I believe the documentation for the tune parameter is incorrect.

The documentation mentions that the order is: Imsak,Fajr,Sunrise,Zhuhr,Asr,Sunset,Maghrib,Isha,Midnight

However, I think Sunset,Maghrib are flipped.

The example URL has Sunset = 3 and Maghrib = 4: https://api.aladhan.com/timingsByAddress/09-03-2015?address=Dubai,UAE&method=8&tune=2,3,4,5,2,3,4,5,-3

However, the response clearly uses Sunset = 4 and Maghrib = 3:

"offset":{"Imsak":"2","Fajr":"3","Sunrise":"4","Dhuhr":"5","Asr":"2","Maghrib":"3","Sunset":"4","Isha":"5","Midnight":"-3"}

Should the documentation describing the order be updated?

Incorrect calculation post daylight savings

Post daylight savings, (using the Umm ul-Qurra method) the Isha calculation after maghrib is off by 30 minutes. it used to correctly show Isha being 90 minutes after maghrib, but now it's 120 minutes after maghrib

Change in UI

I am planning to change the following set in the wesite:

  1. Font Weight
  2. Font Color

Introduce better error handling for unknown locations

As /play and /calendar are now rendering on the server side, we're logging some bad location errors for locations we can't geolocate.

We need a pretty and graceful way to handle these 400 errors from the API.

A try and catch will do, but the app routes file needs cleaning up and this is an opportunity to get a handle on some of that code.

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.