Search by

astroinsightapi / astroinsight-php-sdk

AstroInsightApi

Official PHP SDK for the Astro Insight API - Astrology, Numerology, Panchang, Tarot, and Divination services.

Package info

github.com/AstroInsightApi/astroinsight-php-sdk

pkg:composer/astroinsightapi/astroinsight-php-sdk

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-08-16 16:56 UTC

This package is auto-updated.

Last update: 2026-09-16 17:31:20 UTC


README

Latest Stable Version PHP Version License

Official, strongly-typed PHP 8.1+ SDK for the Astro Insight API. Easily integrate comprehensive Vedic Astrology, Western Astrology, Matchmaking, Panchang, Muhurta, Tarot, Numerology, Chinese Astrology, and Geolocation calculations into your PHP applications.

Features

  • 🪐 Vedic Astrology: Ashtakvarga, Vimshottari / Char / Yogini Dashas, KP System, Jaimini, Lal Kitab, Varshaphal, Ghat Chakra, Horoscope Charts & Doshas.
  • 💍 Matchmaking: Guna Milan, Kundali Compatibility, Manglik Matching.
  • 🗓️ Panchang & Muhurta: Daily Panchang, Choghadiya, Hora, Shubh Muhurta timing.
  • 🔮 Western Astrology & Tarot: Natal Charts, Solar Return, Daily/Weekly/Monthly Transits, Synastry, Tarot spreads (One-card, Three-card, Celtic Cross, Love, Career).
  • 🔢 Numerology: Vedic & Western Numerology (Life Path, Destiny, Soul Urge).
  • ☯️ Chinese Astrology & Biorhythm: Zodiac sign compatibility & biorhythm calculations.
  • 🌍 Geo Utilities: Place search, timezone lookup by coordinates or ID.
  • 🛡️ Strongly Typed DTOs: Clean BirthDetails, MatchInput, and GeoLocation objects.
  • ⚡ PSR-4 Compliant & Guzzle Powered: Exception handling for authentication, validation (422), rate limits (429), and server errors.

Installation

Install the package via Composer:

composer require astroinsightapi/astroinsight-php-sdk

Quick Start

1. Initialize the Client

use AstroInsight\AstroClient;

$astro = new AstroClient(
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
    baseUrl: 'https://json.astroinsightapi.com/api/v1', // Optional
    language: 'en',                             // Optional (e.g. 'hi', 'es')
    ayanamsha: 'lahiri'                         // Optional (e.g. 'raman', 'kp')
);

2. Using Data Transfer Objects (DTOs)

Create a BirthDetails object for birth chart calculations:

use AstroInsight\DTO\BirthDetails;

$birth = new BirthDetails(
    day: 15,
    month: 8,
    year: 1995,
    hour: 10,
    min: 30,
    sec: 0,
    tzone: 5.5,
    lat: 28.6139,
    lon: 77.2090
);

Code Examples

🪐 Vedic Astrology & Dashas

// 1. Get Sun Bhinnashtakavarga
$sunAshtak = $astro->vedic->ashtakvarga->getPlanetAshtak('sun', $birth);

// 2. Fetch Major Vimshottari Dasha
$vimshottari = $astro->vedic->vimshottariDasha->getMajorDasha($birth);

// 3. Get Gemstone & Rudraksha Remedies
$gemstones = $astro->vedic->suggestions->getGemstoneSuggestions($birth);

// 4. Check Manglik Dosha
$manglik = $astro->vedic->horoscopeDosha->getManglikDosha($birth);

💍 Matchmaking (Guna Milan)

use AstroInsight\DTO\MatchInput;

$maleBirth = new BirthDetails(15, 8, 1995, 10, 30, lat: 28.6139, lon: 77.2090);
$femaleBirth = new BirthDetails(20, 11, 1997, 14, 15, lat: 19.0760, lon: 72.8777);

$matchInput = new MatchInput($maleBirth, $femaleBirth);

// Calculate Guna Milan
$gunaScore = $astro->vedic->matchMaking->getGunaMilan($matchInput);

🗓️ Daily Panchang & Muhurta

// Daily Panchang
$panchang = $astro->vedic->panchang->getDailyPanchang($birth);

// Choghadiya Timings
$choghadiya = $astro->vedic->muhurta->getChoghadiya($birth);

🔮 Tarot Readings

// One Card Tarot Reading
$oneCard = $astro->tarot->getOneCardReading();

// Three Card Tarot Reading
$threeCard = $astro->tarot->getThreeCardReading();

// Yes / No Tarot Reading
$yesNo = $astro->tarot->getYesNoReading();

📊 Horoscope Predictions

// Daily Horoscope for Leo
$leoDaily = $astro->horoscope->getDailyHoroscope('leo');

// Monthly Horoscope for Aries
$ariesMonthly = $astro->horoscope->getMonthlyHoroscope('aries');

Dynamic Configuration & Headers

You can update the default language or Ayanamsha dynamically on the client:

// Switch language to Hindi
$astro->setLanguage('hi');

// Switch Ayanamsha calculation system
$astro->setAyanamsha('raman');

Exception Handling

All API errors throw domain-specific exceptions extending AstroInsight\Exceptions\AstroException:

use AstroInsight\Exceptions\AuthenticationException;
use AstroInsight\Exceptions\ValidationException;
use AstroInsight\Exceptions\RateLimitException;
use AstroInsight\Exceptions\AstroException;

try {
    $response = $astro->vedic->panchang->getDailyPanchang($birth);
} catch (AuthenticationException $e) {
    echo "Invalid Client ID or Secret: " . $e->getMessage();
} catch (ValidationException $e) {
    echo "Validation failed: " . $e->getMessage();
    print_r($e->getErrors());
} catch (RateLimitException $e) {
    echo "Rate limit exceeded. Try again later.";
} catch (AstroException $e) {
    echo "API Error: " . $e->getMessage();
}

Running Tests

To run the unit test suite using PHPUnit:

php composer.phar install
./vendor/bin/phpunit

License

This SDK is open-sourced software licensed under the MIT License.