kunjara / jyotish

PHP library for calculations in Vedic astrology
http://jyotish.su
175 stars 118 forks source link

Using It #1

Open krishnaguragain opened 9 years ago

krishnaguragain commented 9 years ago

How to use this library ??

rajeev-k-tomy commented 9 years ago

I am also planning to use it.. I just want to know whether this repo is ready for using in production environment !!

kunjara commented 9 years ago

Documentation coming soon.

vtoms commented 9 years ago

jyotish.su looks great!! I am very much looking forward to the documentation to use for Panchanga and natal charts. I have been trying to make the swetest.exe work but it always ends up with the wrong output.

klodha commented 8 years ago

Is it possible to get hindu month name for current tithi using this api?

mahen3d commented 8 years ago

is it possible to add the matching capability to this ? plus ability to change the charkra to East indian style will be great.

kunjara commented 8 years ago

is it possible to add the matching capability to this? plus ability to change the charkra to East indian style will be great.

You can choose one of three styles: East, North or South

sathishnagarajan01 commented 7 years ago

This is great library, i know little bit about astrology, i got your library which is ganita and base is the core for passing the arguments of date, time, timezone, etc... , eventhough some confusion occurs, so we all waiting for your documentation, Thank you for this great work.

kunjara commented 7 years ago

Documentation will be after library should be released stable.

Kalianey commented 7 years ago

What is the main function to call to get a chart calculation? Like on your demo website, which function are you calling with the button Calculate -> Chakra (Chart)? Some pointers would be great :)

rohithdiya commented 7 years ago

Hi, how do i use your library to calculate Rasi of a person based on his date of birth, time of birth and place of birth ?

rahulyhg commented 7 years ago

any documentation?

nagarajan010 commented 7 years ago

Hi, I think I have managed to find how to use the library, below is the process i have used to generate birth chart data

  1. Download the library from github
  2. you need composer to install additional required libraries
  3. go to the downloaded directory, where you can see a composer.json file
  4. run composer install in the directory
  5. After it's finished, create a new index.php file in that directory, add the following code in it
require './vendor/autoload.php';

use Jyotish\Base\Data;
use Jyotish\Base\Locality;
use Jyotish\Base\Analysis;
use Jyotish\Ganita\Method\Swetest;
use Jyotish\Dasha\Dasha;
$Locality = new Locality([
            'longitude' => "11.09",
            'latitude' => "79.6",
            'altitude' => 0,
            ]);
$DateTime = new DateTime();
$DateTime->setTimezone(new DateTimeZone('Asia/Kolkata'));
$DateTime->setDate(2017,09,26);
$DateTime->setTime(19,18);
$Ganita = new Swetest(["swetest" => "./vendor/kunjara/swetest/win/"]);
// for linux
// run sudo apt install libswe-dev
// after that use 
// $Ganita = new Swetest(["swetest" => "/usr/bin/"]);
$data = new Data($DateTime, $Locality, $Ganita);
// To Calculate Panchangam
$data->calcParams();
$data->calcRising();
$data->calcPanchanga();
// To calculate Upagraha
$data->calcUpagraha();
// To calculate Birth chart Divisions
$data->calcVargaData(["D1","D2","D3","D4","D7","D9","D10","D12",
"D16","D20","D24","D27","D30","D40","D45","D60"]);

you will get the degrees of planets with correct lagna

Update: Thanks to @mattchambers for pointing out the error in timezone setting

Update: Thanks to @eaglehawkstudio fixed an error in swetest path for windows

mattchambers commented 6 years ago

@nagarajan010

You're example works great but when I used it, the data returned from the library was inaccurate. I realized it was due to the timezone being stated after the date and time for the DateTime object.

Here's what I did and everything works like a charm using your example.

Thank you

$DateTime = new DateTime();
$DateTime->setTimezone(new DateTimeZone('America/New_York'));
$DateTime->setDate(2017,09,26);
$DateTime->setTime(19,18);
nagarajan010 commented 6 years ago

@mattchambers

Thank you, by using your example am able to get accurate data and I have updated the code in my above post

Kalianey commented 6 years ago

With this code I get a lot of notices (like 50) and the data is incomplete: Notice: Undefined index: Sy in /Applications/XAMPP/xamppfiles/htdocs/jyotish-master/src/Graha/Upagraha.php on line 76 Notice: Undefined offset: 2 in /Applications/XAMPP/xamppfiles/htdocs/jyotish-master/src/Ganita/Method/Swetest.php on line 283 Notice: Undefined index: graha in /Applications/XAMPP/xamppfiles/htdocs/jyotish-master/src/Ganita/Method/Swetest.php on line 251 etc... Any idea why?

nagarajan010 commented 6 years ago

@Kalianey i think as you are in mac you need to find a mac version of Swetest and replace in that folder

mattchambers commented 6 years ago

@Kalianey

what OS are you developing in and plan to deploy in?

eaglehawkstudio commented 6 years ago

Thank you for the instructions above Having the same issue as @Kalianey - On Mac OSX locally and Linux remotely. Any luck finding a mac version of Swetest?

nagarajan010 commented 6 years ago

@eaglehawkstudio I have not been able to find any solution to make it work in mac, my suggestion is to use a Linux or Windows machine to develop

eaglehawkstudio commented 6 years ago

Thank you @nagarajan010 - Now have it working beautifully on Windows. A couple of notes:

imviv3k commented 6 years ago

I just followed the above given steps but getting the following error.

Notice: Undefined variable: DateTime in C:\xampp\htdocs\astro1\jyotish\index.php on line 15

Fatal error: Call to a member function setTimezone() on null in C:\xampp\htdocs\astro1\jyotish\index.php on line 15

Please help! Thanks

nagarajan010 commented 6 years ago

@imviv3k please add this like before you set the time zone $DateTime = new DateTime(); The code has been corrected to include this line in the post above

imviv3k commented 6 years ago

Hellow @nagarajan010 After setting that line of code i am getting the following output, Notice: Undefined offset: 2 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 281

Notice: Undefined offset: 2 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 3 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 5 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 6 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 3 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 281

Notice: Undefined offset: 2 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 3 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 5 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 6 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 4 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 281

Notice: Undefined offset: 2 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 3 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 5 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 6 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 5 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 281

Notice: Undefined offset: 2 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 3 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 5 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 6 in C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method\Swetest.php on line 284

Warning: Division by zero in C:\xampp\htdocs\astro1\jyotish\src\Panchanga\AngaDefiner.php on line 267

and nothing is being displayed thereafter. I will be very much thankful for your kind help.

rahulyhg commented 6 years ago

@imviv3k mail me details will guide you.

nagarajan010 commented 6 years ago

@imviv3k i think you have not configured the swetest well, you need to make sure there is a swetest.exe in folder vendor\kunjara\swetest\win\

imviv3k commented 6 years ago

thanks a lot for replying first image shows the root folder where i have created index.php file. (code taken from above post) but i can see swetest.exe file is there in vendor\kunjara\swetest\win\ folder. 1 2

astrosanthosh commented 6 years ago

changing swetest.exe to the folder where index.php is there will solve your problem.

imviv3k commented 6 years ago

@astrosanthosh that did not help!

astrosanthosh commented 6 years ago

I mean in the folder where exec command used, this folder C:\xampp\htdocs\astro1\jyotish\src\Ganita\Method

krishnaguragain commented 6 years ago

The error is produced by an empty array at Swetest.php:281 Please use isset there.

krishnaguragain commented 6 years ago

Something like str_replace(' ', '', (isset($matches[2]))?$matches[2]:NULL).' '.str_replace(' ', '',(isset($matches[3]))?$matches[3]:NULL); instead of str_replace(' ', '', $matches[2]).' '.str_replace(' ', '', $matches[3]);

imviv3k commented 6 years ago

@rahulyhg will you please drop me your email at vivek@vivekpublicschool(dot)edu(dot)in g will you please drop me your email at vivek@vivekpublicschool(dot)edu(dot)in

rahulyhg commented 6 years ago

@imviv3k mail sent.

southglitz commented 6 years ago

any one please help me to use this software please southglitz at gmail dot com

buzznirnay commented 6 years ago

@nagarajan010 Request you to help me with the error. I am using PHP 7.0.30 to build the library and run it through APACHE. Now it throws me an error saying that Fatal error: Cannot use 'Object' as class name as it is reserved in C:\xampp\htdocs\Jyotish\src\Base\Object.php on line 14

nagarajan010 commented 6 years ago

@buzznirnay please post the code you use and the error message you get, else its hard to find out the issue

buzznirnay commented 6 years ago

@nagarajan010 Thanks for the swift response.

I have used the same steps as provided by you above. I have used the same index.php file as defined by you. It was giving me some error regarding the object cannot be used as a class name. Researched and found out I have to downgrade to 7.0.25. Now I am on XAMPP7.0.2 and PHP 7.0.25. Now on going to localhost/jyotish/index.php shows a blank page.

What to do ? Please suggest? Let me know what codes you want in case you need any.

Solution will be really appreciated

nagarajan010 commented 6 years ago

@buzznirnay after this line

$data->calcVargaData(["D1","D2","D3","D4","D7","D9","D10","D12", "D16","D20","D24","D27","D30","D40","D45","D60"]);

add

var_dump($data);

and you will see the data of each varga

buzznirnay commented 6 years ago

object(Jyotish\Base\Data)#5 (4) { ["DateTime":"Jyotish\Base\Data":private]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2017-09-26 19:18:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(12) "Asia/Kolkata" } ["Locality":"Jyotish\Base\Data":private]=> object(Jyotish\Base\Locality)#3 (3) { ["longitude":protected]=> float(11.09) ["latitude":protected]=> float(79.6) ["altitude":protected]=> float(0) } ["Ganita":"Jyotish\Base\Data":private]=> object(Jyotish\Ganita\Method\Swetest)#4 (10) { ["swe":protected]=> array(2) { ["swetest"]=> string(29) "./vendor/kunjara/swetest/win/" ["sweph"]=> string(29) "./vendor/kunjara/swetest/win/" } ["inputAyanamsha":protected]=> array(10) { ["Fagan"]=> string(1) "0" ["Lahiri"]=> string(1) "1" ["Deluce"]=> string(1) "2" ["Raman"]=> string(1) "3" ["Ushashashi"]=> string(1) "4" ["Krishnamurti"]=> string(1) "5" ["Djwhalkhul"]=> string(1) "6" ["Yukteshwar"]=> string(1) "7" ["Jnbhasin"]=> string(1) "8" ["Sassanian"]=> string(2) "16" } ["inputPlanets":protected]=> array(8) { ["Sy"]=> string(1) "0" ["Ch"]=> string(1) "1" ["Ma"]=> string(1) "4" ["Bu"]=> string(1) "2" ["Gu"]=> string(1) "5" ["Sk"]=> string(1) "3" ["Sa"]=> string(1) "6" ["Ra"]=> string(1) "m" } ["outputPlanets":protected]=> array(8) { ["Sun"]=> string(2) "Sy" ["Moon"]=> string(2) "Ch" ["Mars"]=> string(2) "Ma" ["Mercury"]=> string(2) "Bu" ["Jupiter"]=> string(2) "Gu" ["Venus"]=> string(2) "Sk" ["Saturn"]=> string(2) "Sa" ["meanNode"]=> string(2) "Ra" } ["outputHouses":protected]=> array(12) { ["house1"]=> int(1) ["house2"]=> int(2) ["house3"]=> int(3) ["house4"]=> int(4) ["house5"]=> int(5) ["house6"]=> int(6) ["house7"]=> int(7) ["house8"]=> int(8) ["house9"]=> int(9) ["house10"]=> int(10) ["house11"]=> int(11) ["house12"]=> int(12) } ["outputLagna":protected]=> array(2) { ["Ascendant"]=> string(2) "Lg" ["MC"]=

@nagarajan010 please HELP I am getting something like this. Is this the expected output. If yes, then how to display the data on the webpage? If no, please suggest what to do?

Beginner here so please bear with me

nagarajan010 commented 6 years ago

@buzznirnay

i will post a full example some time today

buzznirnay commented 6 years ago

@nagarajan010 That will be so helpful. Will be waiting for the same.

nagarajan010 commented 6 years ago

@buzznirnay I have done a small example using different features of the library



<?php
require './vendor/autoload.php';
// error_reporting(E_ALL);
// ini_set('display_errors', 1);
use Jyotish\Base\Data;
use Jyotish\Base\Locality;
use Jyotish\Base\Analysis;
use Jyotish\Ganita\Method\Swetest;
use Jyotish\Dasha\Dasha;
$Locality = new Locality([
            'longitude' => "77.80",
            'latitude' => "11.56",
            'altitude' => 0,
            ]);

$DateTime = new DateTime();
$DateTime->setTimezone(new DateTimeZone('Asia/Kolkata'));
$DateTime->setDate(2000, 8, 27);
$DateTime->setTime(15,28);
// $Ganita = new Swetest(["swetest" => ""]);
// // for linux
// // run sudo apt install libswe-dev
// // after that use 
$Ganita = new Swetest(["swetest" => "./vendor/kunjara/swetest/win/"]);
// $Ganita = new Swetest(["swetest" => "/usr/bin/"]);
$data = new Data($DateTime, $Locality, $Ganita);
// To Calculate Panchangam
$data->calcParams();
$data->calcRising();
$data->calcPanchanga();
// To calculate Upagraha
$data->calcUpagraha();

$data->calcDasha("vimshottari", null);
        // $data->calcYoga(['mahapurusha','Dhana','RAJA']);
        // $data->calcHora();
    $data->calcExtraLagna();
    // $data->calcBhavaArudha();
    $Analysis = new Analysis($data);
        $new = [
            "data" => $data,
            "Analysis" => $Analysis,
        ];

$dasha = $data->getData()['dasha']['vimshottari']['periods'];

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-md-4">
                <h3>Panchanga</h3>
                <ul>
                    <li>Thiti: <?php echo $data->getData()['panchanga']['tithi']['paksha'] . ' ' .$data->getData()['panchanga']['tithi']['name'] . ' ' .round($data->getData()['panchanga']['tithi']['left'], 2) . ' % left'; ?></li>
                    <li>Nakshatra: <?php echo $data->getData()['panchanga']['nakshatra']['name']; ?></li>
                    <li>Yoga: <?php echo $data->getData()['panchanga']['yoga']['name']; ?></li>
                    <li>Vara: <?php echo $data->getData()['panchanga']['vara']['name']; ?> Lord: <?php echo $data->getData()['panchanga']['vara']['key']; ?></li>
                    <li>Karana: <?php echo $data->getData()['panchanga']['karana']['name']; ?></li>
                </ul>
            </div>

            <div class="col-md-4">
                <h5>D1 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($data->getData()['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($data->getData()['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D2 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D2")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D2")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D3 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D3")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D3")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D4 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D4")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D4")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D7 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D7")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D7")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D9 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D9")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D9")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D10 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D10")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D10")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D12 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D12")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D12")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D16 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D16")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D16")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D20 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D20")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D20")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D24 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D24")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D24")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D27 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D27")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D27")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D30 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D30")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D30")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D40 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D40")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D40")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D45 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D45")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D45")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h5>D60 Details</h5>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Degree</th>
                            <th>Sign</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($Analysis->getVargaData("D60")['lagna'] as $key => $lagna): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $lagna['longitude']; ?></td>
                            <td><?php echo $lagna['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                        <?php foreach ($Analysis->getVargaData("D60")['graha'] as $key => $graha): ?>
                        <tr>
                            <td><?php echo $key; ?></td>
                            <td><?php echo $graha['longitude']; ?></td>
                            <td><?php echo $graha['rashi']; ?></td>
                        </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="col-md-4">
                <h2 class="sub-heading-dasha">Vimshotri Maha Dasha</h2>
      <ul>
        <?php foreach ($dasha as $key => $single): ?>
        <li  class="dasha"><?php echo $key ?> - <?php echo $single['start'] ?> - <?php echo $single['end'] ?>

            <ul class="antradasha">
                <?php foreach ($single['periods'] as $key => $one): ?>
                <h2 class="sub-heading-dasha">Antardasha</h2>
                <li><?php echo $key ?> - <?php echo $one['start'] ?> - <?php echo $one['end'] ?>

                    <ul>
                        <h2 class="sub-heading-dasha">Pratyantardasha</h2>

                    <?php foreach ($one['periods'] as $key => $one): ?>
                        <li><?php echo $key ?> - <?php echo $one['start'] ?> - <?php echo $one['end'] ?></li>
        <?php endforeach ?>
                    </ul> 
                </li>

        <?php endforeach ?>
            </ul> 
        </li>   
        <?php endforeach ?>
    </ul>
            </div>
        </div>
    </div>
</body>
</html>
buzznirnay commented 6 years ago

@nagarajan010 It works like magic!! Thanks a ton for your help.

Just wondering whether are there any more data which can be called

nagarajan010 commented 6 years ago

@buzznirnay I have forgot to add upagarhas and there are arudha and bhava arudhas and hora calculations but arudha calculation is done using degrees which i dont use

and the library by default uses lahiri ayanamsha

when you use php it auto calculates all the day light savings time for the year, but its not very good for war time around year 1945

shikhardb commented 6 years ago

@nagarajan010 I tried to do with your example. But i get this error:

image

@buzznirnay Would you be able to explain how you did it?

buzznirnay commented 6 years ago

@shikhardb What is the environment that you are using? What version of PHP are you using? Have you build the library after downloading the files. Have you got a sweetest.exe file in those libraries

shikhardb commented 6 years ago

@buzznirnay My PHP version is 5.6.31 I'm running on WampServer Version 3.1.0 On a Windows 10 machine. I have the swetest.exe also. I downloaded all dependencies by composer.phar

Am I still missing something?

nagarajan010 commented 6 years ago

@shikhardb please post your code here the error message is saying it cant find the variable $data are you sure you have copied the full code from example ? also did you check and make sure if the swetest.exe path is correct ?

shikhardb commented 6 years ago

@nagarajan010 Yes, I copied the complete code as below

require './vendor/autoload.php'; // error_reporting(E_ALL); // ini_set('display_errors', 1); use Jyotish\Base\Data; use Jyotish\Base\Locality; use Jyotish\Base\Analysis; use Jyotish\Ganita\Method\Swetest; use Jyotish\Dasha\Dasha; $Locality = new Locality([ 'longitude' => "77.80", 'latitude' => "11.56", 'altitude' => 0, ]);

$DateTime = new DateTime(); $DateTime->setTimezone(new DateTimeZone('Asia/Kolkata')); $DateTime->setDate(2000, 8, 27); $DateTime->setTime(15,28); // $Ganita = new Swetest(["swetest" => ""]); // // for linux // // run sudo apt install libswe-dev // // after that use $Ganita = new Swetest(["swetest" => "./vendor/kunjara/swetest/win/"]); // For Linux // $Ganita = new Swetest(["swetest" => "/usr/bin/"]); $data = new Data($DateTime, $Locality, $Ganita); // To Calculate Panchangam $data->calcParams(); $data->calcRising(); $data->calcPanchanga(); // To calculate Upagraha $data->calcUpagraha();

$data->calcDasha("vimshottari", null); // $data->calcYoga(['mahapurusha','Dhana','RAJA']); // $data->calcHora(); $data->calcExtraLagna(); // $data->calcBhavaArudha(); $Analysis = new Analysis($data); $new = [ "data" => $data, "Analysis" => $Analysis, ];

$dasha = $data->getData()['dasha']['vimshottari']['periods'];

?>

<!DOCTYPE html>

Document

Panchanga

  • Thiti: getData()['panchanga']['tithi']['paksha'] . ' ' .$data->getData()['panchanga']['tithi']['name'] . ' ' .round($data->getData()['panchanga']['tithi']['left'], 2) . ' % left'; ?>
  • Nakshatra: getData()['panchanga']['nakshatra']['name']; ?>
  • Yoga: getData()['panchanga']['yoga']['name']; ?>
  • Vara: getData()['panchanga']['vara']['name']; ?> Lord: getData()['panchanga']['vara']['key']; ?>
  • Karana: getData()['panchanga']['karana']['name']; ?>
D1 Details
getData()['lagna'] as $key => $lagna): ?> getData()['graha'] as $key => $graha): ?>
Name Degree Sign
D2 Details
getVargaData("D2")['lagna'] as $key => $lagna): ?> getVargaData("D2")['graha'] as $key => $graha): ?>
Name Degree Sign
D3 Details
getVargaData("D3")['lagna'] as $key => $lagna): ?> getVargaData("D3")['graha'] as $key => $graha): ?>
Name Degree Sign
D4 Details
getVargaData("D4")['lagna'] as $key => $lagna): ?> getVargaData("D4")['graha'] as $key => $graha): ?>
Name Degree Sign
D7 Details
getVargaData("D7")['lagna'] as $key => $lagna): ?> getVargaData("D7")['graha'] as $key => $graha): ?>
Name Degree Sign
D9 Details
getVargaData("D9")['lagna'] as $key => $lagna): ?> getVargaData("D9")['graha'] as $key => $graha): ?>
Name Degree Sign
D10 Details
getVargaData("D10")['lagna'] as $key => $lagna): ?> getVargaData("D10")['graha'] as $key => $graha): ?>
Name Degree Sign
D12 Details
getVargaData("D12")['lagna'] as $key => $lagna): ?> getVargaData("D12")['graha'] as $key => $graha): ?>
Name Degree Sign
D16 Details
getVargaData("D16")['lagna'] as $key => $lagna): ?> getVargaData("D16")['graha'] as $key => $graha): ?>
Name Degree Sign
D20 Details
getVargaData("D20")['lagna'] as $key => $lagna): ?> getVargaData("D20")['graha'] as $key => $graha): ?>
Name Degree Sign
D24 Details
getVargaData("D24")['lagna'] as $key => $lagna): ?> getVargaData("D24")['graha'] as $key => $graha): ?>
Name Degree Sign
D27 Details
getVargaData("D27")['lagna'] as $key => $lagna): ?> getVargaData("D27")['graha'] as $key => $graha): ?>
Name Degree Sign
D30 Details
getVargaData("D30")['lagna'] as $key => $lagna): ?> getVargaData("D30")['graha'] as $key => $graha): ?>
Name Degree Sign
D40 Details
getVargaData("D40")['lagna'] as $key => $lagna): ?> getVargaData("D40")['graha'] as $key => $graha): ?>
Name Degree Sign
D45 Details
getVargaData("D45")['lagna'] as $key => $lagna): ?> getVargaData("D45")['graha'] as $key => $graha): ?>
Name Degree Sign
D60 Details
getVargaData("D60")['lagna'] as $key => $lagna): ?> getVargaData("D60")['graha'] as $key => $graha): ?>
Name Degree Sign

Vimshotri Maha Dasha

    $single): ?>
  • - -
      $one): ?>

      Antardasha

    • - -

        Pratyantardasha

        $one): ?>
      • - -

And the error which I am getting is :

image

nagarajan010 commented 6 years ago

@shikhardb

i think you forgot to add the opening php tags at top

like this before require

<?php
require './vendor/autoload.php';

can you check it ?

it was not in my code before sorry!