PHPackages                             vking/bazi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. vking/bazi

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vking/bazi
==========

中国文化：用日期及时辰计算出生辰八字，八字命盘

4162PHP

Since Aug 31Pushed 8y ago2 watchersCompare

[ Source](https://github.com/myzingy/bazi)[ Packagist](https://packagist.org/packages/vking/bazi)[ RSS](/packages/vking-bazi/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

八字命盘
====

[](#八字命盘)

### 目前功能

[](#目前功能)

- 根据阳历或阴历计算八字，根据八字天干地支显示命盘五行

### 后期功能

[](#后期功能)

- 1，命盘得分（命硬、命弱判断）
- 2，喜神
- 。。。

Installing
----------

[](#installing)

```
    $ composer require vking/bazi -vvv

```

Usage
-----

[](#usage)

```
    use Vking\Bazi;
    //阳历2017年08月31日 12时出生
    //$fate = new Fate(1234567890);//支持时间戳方式
    $fate = new Fate("2017-08-31-12");
    var_dump($fate->get());

    //阴历2017年08月31日 12时出生
    //$fate = new Fate("2017-08-31-12",true);
    $fate->set("2017-08-31-12",true);
    var_dump($fate->get());

    //阴历2017年润08月31日 12时出生
    //$fate = new Fate("2017-08-31-12",true,true);
    $fate->set("2017-08-31-12",true,true);
    var_dump($fate->get());
```

Return
------

[](#return)

```
    {
        "lunar_year": 2017,                 // 农历年
        "lunar_month": 4,                   // 农历月
        "lunar_day": 10,                    // 农历日
        "lunar_month_chinese": "四月",       // (汉字)农历月
        "lunar_day_chinese": "初十",         // (汉字)农历日
        "ganzhi_year": "丁酉",               // (干支)年
        "ganzhi_month": "乙巳",              // (干支)月
        "ganzhi_day": "壬辰",                // (干支)日
        "animal": "鸡",                      // 生肖
        "term": "立夏",                      // 节气
        "is_leap": false,                    // 是否为闰月
        "gregorian_year": 2017,              // 公历年
        "gregorian_month": 5,                // 公历月
        "gregorian_day": 5,                  // 公历日
        "week_no": 5,                        // (数字)星期几
        "week_name": "星期五",                // (汉字)星期几
        "is_today": false,                   // 是否为今天
        "constellation": "金牛"               // 星座
        "ganzhi_hour":"壬子"                  // (干支)时
        [bazi_wuxing] => [                   // 按年月日时的干支对应的五行
            [己] => 土,
            [丑] => 土,
            [丙] => 火,
            [寅] => 木,
            [庚] => 金,
            [寅] => 木,
            [丙] => 火,
            [辰] => 土
        ]
    }

```

License
-------

[](#license)

```
MIT

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/00e59f3dc17a1d430b4f4f59d3cfd5ab0f6a6350c19e7fcfca0f0a2d05ed1f6a?d=identicon)[vking](/maintainers/vking)

---

Top Contributors

[![vkingx](https://avatars.githubusercontent.com/u/38235069?v=4)](https://github.com/vkingx "vkingx (3 commits)")

### Embed Badge

![Health badge](/badges/vking-bazi/health.svg)

```
[![Health](https://phpackages.com/badges/vking-bazi/health.svg)](https://phpackages.com/packages/vking-bazi)
```

###  Alternatives

[spatie/laravel-multitenancy

Make your Laravel app usable by multiple tenants

1.3k2.9M16](/packages/spatie-laravel-multitenancy)[michelf/php-smartypants

PHP SmartyPants

1115.3M30](/packages/michelf-php-smartypants)[leocarmo/circuit-breaker-php

Circuit Breaker for PHP

300447.3k3](/packages/leocarmo-circuit-breaker-php)[riimu/kit-phpencoder

Highly customizable alternative to var\_export for PHP code generation

717.8M32](/packages/riimu-kit-phpencoder)[statamic/stringy

A string manipulation library with multibyte support, forked from @statamic

234.5M14](/packages/statamic-stringy)[kore/data-object

Simple base class for data objects.

111.2M7](/packages/kore-data-object)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
