Skip to content

lt-25/astrology-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SkyVedic Astrology API — PHP Laravel SDK

PHP Laravel License

A clean, service-oriented PHP SDK for the AstrologyAPI.com / SkyVedic API. Covers all endpoints: Horoscope, Dasha, Panchang, MatchMaking, KP, Lal Kitab, Varshaphal, Numerology, Dosha/Remedies, and more.


Requirements

Component Version
PHP 7.3 – 8.2
Laravel 7.x – 12.x
Guzzle ^6.5 or ^7.0

Installation

composer require lt-25/astrology-api

Laravel Auto-Discovery

The service provider and facade are registered automatically via Laravel's package auto-discovery (extra.laravel in composer.json).

Publish Config

php artisan vendor:publish --tag=skyledic-astrology-api-config

This creates config/astrology-api.php.


Configuration

Add these keys to your .env:

ASTROLOGY_API_BASE_URL=https://json.astrologyapi.com
ASTROLOGY_API_VERSION=v1
ASTROLOGY_API_USER_ID=your_user_id
ASTROLOGY_API_KEY=your_api_key
ASTROLOGY_API_LANGUAGE=en
ASTROLOGY_API_TIMEOUT=30
ASTROLOGY_API_VERIFY_SSL=true

# For SkyVedic local mirror:
# ASTROLOGY_API_BASE_URL=http://localhost:3000

Usage

Via Facade

use SkyVedic\AstrologyApi\Facades\AstrologyApi;
use SkyVedic\AstrologyApi\BirthData;

$bd = new BirthData(27, 6, 2000, 15, 30, 25.7464, 82.6837, 5.5);

// Planets
$planets = AstrologyApi::horoscope()->planets($bd);

// Birth details
$birth = AstrologyApi::horoscope()->birthDetails($bd);

// Current dasha
$dasha = AstrologyApi::dasha()->currentVdashaAll($bd);

// Panchang
$panchang = AstrologyApi::panchang()->basicPanchang($bd);

Via Dependency Injection

use SkyVedic\AstrologyApi\AstrologyApi;
use SkyVedic\AstrologyApi\BirthData;

class AstrologyController extends Controller
{
    protected $api;

    public function __construct(AstrologyApi $api)
    {
        $this->api = $api;
    }

    public function planets()
    {
        $bd = new BirthData(27, 6, 2000, 15, 30, 25.7464, 82.6837, 5.5);
        return $this->api->horoscope()->planets($bd);
    }
}

Without Laravel (standalone)

use SkyVedic\AstrologyApi\AstrologyApi;
use SkyVedic\AstrologyApi\BirthData;

$api = new AstrologyApi('your_user_id', 'your_api_key');

$bd = new BirthData(27, 6, 2000, 15, 30, 25.7464, 82.6837, 5.5);
$planets = $api->horoscope()->planets($bd);

Services & Methods

GeoService — $api->geo()

$api->geo()->geoDetails('Mumbai', 6);
$api->geo()->timezoneWithDst($day, $month, $year, $hour, $min, $lat, $lon, $tzone);

HoroscopeService — $api->horoscope()

$api->horoscope()->birthDetails($bd);
$api->horoscope()->astroDetails($bd);
$api->horoscope()->planets($bd);
$api->horoscope()->planetsExtended($bd, '#FF0000', '#00FF00', '#0000FF', 'north');
$api->horoscope()->planetNature($bd);
$api->horoscope()->horoChart($bd, 'D9');           // D1, D2, D3, D7, D9, D10, D12...
$api->horoscope()->horoChartImage($bd, 'D9');
$api->horoscope()->horoChartExtended($bd);
$api->horoscope()->ayanamsha($bd);
$api->horoscope()->bhavMadhya($bd);
$api->horoscope()->ghatChakra($bd);
$api->horoscope()->panchadaMaitri($bd);
$api->horoscope()->planetAshtak($bd, 'mars');      // sun,moon,mars,mercury,venus,jupiter,saturn
$api->horoscope()->sarvashtak($bd);
$api->horoscope()->biorhythm($bd);
$api->horoscope()->moonBiorhythm($bd);

DashaService — $api->dasha()

$api->dasha()->currentVdasha($bd);
$api->dasha()->currentVdashaAll($bd);
$api->dasha()->majorVdasha($bd);
$api->dasha()->subVdasha($bd, 'jupiter');
$api->dasha()->subSubVdasha($bd, 'mars', 'mars');
$api->dasha()->subSubSubVdasha($bd, 'mars', 'jupiter', 'rahu');
$api->dasha()->subSubSubSubVdasha($bd, 'mars', 'jupiter', 'rahu', 'venus');
$api->dasha()->majorYoginiDasha($bd);
$api->dasha()->currentYoginiDasha($bd);
$api->dasha()->subYoginiDasha($bd, 1, 'ulka');
$api->dasha()->currentCharDasha($bd);
$api->dasha()->majorCharDasha($bd);
$api->dasha()->subCharDasha($bd, 'aries');

PanchangService — $api->panchang()

$api->panchang()->basicPanchang($bd);
$api->panchang()->basicPanchangSunrise($bd);
$api->panchang()->advancedPanchang($bd);
$api->panchang()->advancedPanchangSunrise($bd);
$api->panchang()->planetPanchang($bd);
$api->panchang()->planetPanchangSunrise($bd);
$api->panchang()->panchangChartSunrise($bd);
$api->panchang()->monthlyPanchang($bd);
$api->panchang()->tamilPanchang($bd);
$api->panchang()->tamilMonthPanchang($bd);
$api->panchang()->panchangFestival($bd);
$api->panchang()->horaMuhurta($bd);
$api->panchang()->horaMuhurtaDinman($bd);
$api->panchang()->chaughadiyaMuhurta($bd);

MatchMakingService — $api->matchMaking()

$male   = new BirthData(25, 12, 1988, 4,  0,  25.123, 82.34, 5.5);
$female = new BirthData(9,  12, 1990, 12, 56, 25.123, 82.34, 5.5);

$api->matchMaking()->matchBirthDetails($male, $female);
$api->matchMaking()->matchObstructions($male, $female);
$api->matchMaking()->matchAstroDetails($male, $female);
$api->matchMaking()->matchPlanetDetails($male, $female);
$api->matchMaking()->matchManglikReport($male, $female);
$api->matchMaking()->matchAshtakootPoints($male, $female);
$api->matchMaking()->matchDashakootPoints($male, $female);
$api->matchMaking()->matchPercentage($male, $female);
$api->matchMaking()->matchMakingReport($male, $female);
$api->matchMaking()->matchMakingDetailedReport($male, $female);
$api->matchMaking()->simpleManglik($bd);

NumerologyService — $api->numerology()

$api->numerology()->numeroTable(10, 5, 1990, 'Rahul');
$api->numerology()->numeroReport(10, 5, 1990, 'Rahul');
$api->numerology()->numeroFavTime(10, 5, 1990, 'Rahul');
$api->numerology()->numeroPlaceVastu(10, 5, 1990, 'Rahul');
$api->numerology()->numeroFastsReport(10, 5, 1990, 'Rahul');
$api->numerology()->numeroFavLord(10, 5, 1990, 'Rahul');
$api->numerology()->numeroFavMantra(10, 5, 1990, 'Rahul');
$api->numerology()->numeroPredictionDaily(10, 5, 1990, 'Rahul');

DoshaRemedyService — $api->dosha()

$api->dosha()->kalsarpaDetails($bd);
$api->dosha()->sadhesatiCurrentStatus($bd);
$api->dosha()->sadhesatiLifeDetails($bd);
$api->dosha()->sadhesatiRemedies($bd);
$api->dosha()->pitraDosha($bd);
$api->dosha()->gemSuggestion($bd);
$api->dosha()->pujaSuggestion($bd);
$api->dosha()->rudrakshaSuggestion($bd);

PredictionService — $api->prediction()

$api->prediction()->dailyNakshatraPrediction($bd);
$api->prediction()->dailyNakshatraPredictionNext($bd);
$api->prediction()->dailyNakshatraPredictionPrevious($bd);
$api->prediction()->generalAscendantReport($bd);
$api->prediction()->generalNakshatraReport($bd, 'male');
$api->prediction()->generalHouseReport($bd, 'sun');
$api->prediction()->generalRashiReport($bd, 'moon');

KpService — $api->kp()

$api->kp()->kpPlanets($bd);
$api->kp()->kpHouseCusps($bd);
$api->kp()->kpBirthChart($bd);
$api->kp()->kpHouseSignificator($bd);
$api->kp()->kpPlanetSignificator($bd);
$api->kp()->kpHoroscope($bd, 'major');

LalKitabService — $api->lalKitab()

$api->lalKitab()->horoscope($bd);
$api->lalKitab()->debts($bd);
$api->lalKitab()->remedies($bd, 'sun');
$api->lalKitab()->houses($bd);
$api->lalKitab()->planets($bd);

VarshaphalService — $api->varshaphal()

$api->varshaphal()->yearChart($bd);
$api->varshaphal()->monthChart($bd);
$api->varshaphal()->details($bd);
$api->varshaphal()->planets($bd);
$api->varshaphal()->muntha($bd);
$api->varshaphal()->muddaDasha($bd);
$api->varshaphal()->panchavargeeya($bd);
$api->varshaphal()->harshaBala($bd);
$api->varshaphal()->yoga($bd);
$api->varshaphal()->sahamPoints($bd);

TransitService — $api->transit()

$api->transit()->upcomingHouseChanges($bd, 'Delhi', 'LAHIRI', 'P', '2024-08-21T14:00:00', 30, true);

BirthData Object

use SkyVedic\AstrologyApi\BirthData;

$bd = new BirthData(
    day:   27,
    month: 6,
    year:  2000,
    hour:  15,
    min:   30,
    lat:   25.7464,
    lon:   82.6837,
    tzone: 5.5
);

Ayanamsha Values

Value System
LAHIRI Default — Lahiri (Chitrapaksha)
KP_OLD KP Old
KP_NEW KP New (recommended for KP system)
YUKTESHWAR Yukteshwar
RAMAN Raman
JN_BHASIN JN Bhasin
FAGAN_BRADLEY Fagan Bradley (Western Sidereal)

Error Handling

use SkyVedic\AstrologyApi\Exceptions\AstrologyApiException;
use SkyVedic\AstrologyApi\Exceptions\AuthenticationException;
use SkyVedic\AstrologyApi\Exceptions\ValidationException;

try {
    $result = AstrologyApi::horoscope()->planets($bd);
} catch (AuthenticationException $e) {
    // Invalid API key or user ID
} catch (ValidationException $e) {
    // Invalid request parameters
} catch (AstrologyApiException $e) {
    // Other API errors
}

Language Support

// Set Hindi response language
AstrologyApi::setLanguage('hi');

// Or at construction time (standalone)
$api = new AstrologyApi($userId, $apiKey);
$api->setLanguage('hi');

License

MIT

About

Custom astrology api sdk

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages