PHP code example of hejunjie / fortune-analyzer

1. Go to this page and download the library: Download hejunjie/fortune-analyzer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hejunjie / fortune-analyzer example snippets




use Hejunjie\FortuneAnalyzer\FortuneAnalyzer;

$date = '1997-01-21 16:30:00';
$gender = 1; // 1=male, 0=female

// Chart the Four Pillars (BaZi)
$pillars = FortuneAnalyzer::analyzeFourPillars($date);
// ['丙子', '辛丑', '癸亥', '庚申']

// Five Elements statistics (with hidden stems)
$wuXing = FortuneAnalyzer::analyzeWuXingFull($pillars);
// ['金' => 5, '木' => 1, '水' => 7, '火' => 1, '土' => 3]

// Ten Gods interpretation
$shiShen = FortuneAnalyzer::interpretShiShen($pillars);
// Returns frequency (count of each Ten God), statistics (5 categories), analysis (interpretation text)

// Luck Cycles
$luckCycles = FortuneAnalyzer::getLuckCycles($date, $gender);
// Returns 8-step luck cycle, each step