PHP code example of wangta69 / laravel-fortune

1. Go to this page and download the library: Download wangta69/laravel-fortune 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/ */

    

wangta69 / laravel-fortune example snippets


YourDomain/fortune/saju/{ymdhi}/{sl?}/{leap?}

YourDomain/fortune/saj/{ymdhi}/{sl?}/{leap?}

$saju = Saju::ymdhi(...)->create();
$sipsin = $saju->sipsin(); // withSaju가 자동으로 호출됨

// 1. 원국 십신 접근 (타입 힌팅으로 안전)
$monthSipsin_e = $sipsin->month->e; // '편관'

// 2. 지장간에 숨겨진 십신 보기
$zizanganSipsin = $sipsin->getZizanganSipsin();
$hiddenSipsin = $zizanganSipsin->day->정기; // 일지에 숨겨진 진짜 속마음

// 3. 올해 운(예: 甲辰년)과의 관계 보기
$unSipsin = $sipsin->getUnSipsin('甲', '辰');
// $unSipsin->h 는 '정인', $unSipsin->e 는 '상관'
// "올해는 새로운 공부(정인)를 시작하고 싶은 마음과, 기존의 틀을 깨고 싶은(상관) 마음이 충돌하는 한 해입니다." 와 같은 해석 가능

// 4. 십신 개수 요약 보기
$summary = $sipsin->getSipsinCountSummary(); // ['편재' => 2, '정관' => 2, ...]
..........

use Pondol\Fortune\Services\YukimService;

class MyController
{
    private YukimService $yukimService;

    public function __construct(YukimService $yukimService)
    {
        $this->yukimService = $yukimService;
    }
}

$userSaju = Saju::ymdhi('200010101000')->sl('lunar')->leap(true)->create();
$todaySaju = Saju::ymdhi(date('YmdHi'))->sl('solar')->create();

// 1. 정통 720과
$result = $this->yukimService->getReading('720gwa', $todaySaju);

// 2. 지두법
$result = $this->yukimService->getReading('jidu', $todaySaju);

// 3. '본명법'
$result = $this->yukimService->getReading('bonmyeong', $todaySaju, $userSaju);

// 4. 일간과법
$result = $this->yukimService->getReading('ilgangwa', $todaySaju);

// 5. '차객법'
$result = $this->yukimService->getReading('chaekgeok', $todaySaju);

use Pondol\Fortune\Facades\Saju;
use Pondol\Fortune\Facades\Calendar;
..........
$saju = Saju::ymdhi('200010101000')->sl('lunar')->leap(true)->create();
$options = [
    'moving_direction_enabled'=> true or false // 이사방향 처리
    'moving_direction' => '동'|'서'|'남'|'북'

    'family_harmony_enabled'=> true or false // 가족 구성원 생년월일
    'family_years' => ['19901010'....]
];

$moveCalendarData = Calendar::moveCalendar($saju, $yyyymm, $options); // $yyyymm : 년월을 입력하면 년월에 해당하는 모든 일별데이타 출력