承接 intervention/zodiac 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

intervention/zodiac

最新稳定版本:6.0.0

Composer 安装命令:

composer require intervention/zodiac

包简介

Zodiac Sign Calculator

README 文档

README

Latest Version Tests Monthly Downloads Support me on Ko-fi

Intervention Zodiac is a astrological calculator that resolves Western and Chinese zodiac signs from various data types.

Installation

The installation works with Composer by running the following command.

$ composer require intervention/zodiac

Although the library is framework agnostic it comes with a service provider for the Laravel Framework. Which will be discovered automatically and registers the calculator into your installation.

Documentation

Read the full documentation for this library.

Code Examples

Calculator

use Intervention\Zodiac\Calculator;
use Intervention\Zodiac\Astrology;
use Carbon\Carbon;
use DateTime;

$sign = Calculator::fromString('2001-01-01');
$sign = Calculator::fromString('2001-01-01', Astrology::CHINESE);

// create western calculator
$sign = Calculator::western()
    ->fromString('2001-01-01'); 

// create chinese calculator
$sign = Calculator::chinese()
    ->fromString('2001-01-01'); 

// override default
$sign = Calculator::western()
    ->fromString('2001-01-01', Astrology::CHINESE);

// pass astrology as a parameter
$sign = Calculator::withAstrology(Astrology::CHINESE)
    ->fromString('2001-01-01');

// override default
$sign = Calculator::withAstrology(Astrology::CHINESE)
    ->fromString('2001-01-01', Astrology::WESTERN);

// parse various date formats
$sign = Calculator::fromString('first day of june 2014');
$sign = Calculator::fromString('2018-06-15 12:34:00');
$sign = Calculator::fromDate(new DateTime('2001-01-01'));
$sign = Calculator::fromDate(Carbon::yesterday());
$sign = Calculator::fromUnix(228268800);
$sign = Calculator::fromUnix('228268800');

Sign

use Intervention\Zodiac\Calculator;
use DateTime;
use Carbon\Carbon;

// calculate zodiac sing
$sign = Calculator::fromDate($date);

$name = $sign->name(); // 'gemini'
$html = $sign->html(); // '♊︎'
$localized = $sign->localize('fr')->name(); // Gémeaux
$compatibility = $sign->compatibility($sign); // .6

Development & Testing

With this package comes a Docker image to build a test suite container. To build this container you have to have Docker installed on your system.

You can run all tests with the following command.

docker-compose run --rm --build tests

Run the static analyzer on the code base.

docker-compose run --rm --build analysis

Authors

This library is developed and maintained by Oliver Vogel

Thanks to the community of contributors who have helped to improve this project.

License

Intervention Zodiac is licensed under the MIT License.

统计信息

  • 总下载量: 183.41k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 59
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 57
  • Watchers: 1
  • Forks: 15
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-02