承接 scottboms/moon-phases 相关项目开发

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

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

scottboms/moon-phases

最新稳定版本:1.0.3

Composer 安装命令:

composer require scottboms/moon-phases

包简介

Moon Phases for Kirby.

README 文档

README

Plugin Preview

A Kirby 5 plugin that provides moon phase information as a custom Panel Section (type: moon-phases) and to templates using Template Methods ($site->moonPhases() and helpers.

Features

  • Current moon phase name
  • Number of days until the next full moon
  • Number of days until the next new moon
  • API-backed phase/illumination percentage data (ipgeolocation.io astronomy endpoint)
  • Configurable cache
  • Customize SVG icons for moon phases (built-in preset or custom file map)

Requirements

  • Kirby 5.x
  • ipgeolocation.io API key

Installation

Kirby CLI

kirby plugin:install scottboms/kirby-moon-phases

Git Submodule

$ git submodule add https://github.com/scottboms/kirby-moon-phases.git site/plugins/moon-phases

Copy and Paste

  1. Download the contents of this repository as a Zip file.
  2. Rename the extracted folder to moon-phases and copy it into the site/plugins/ directory in your Kirby project.

Configuration

Site Config

In site/config/config.php:

<?php

return [
  'scottboms.moon-phases' => [
    'api' => [
      'provider' => 'ipgeolocation',
      'key' => 'IPGEOLOCATION_API_KEY',
      'baseUrl' => 'https://api.ipgeolocation.io/astronomy',
      'timeout' => 8,
    ],
    'location' => [
      'lat' => 40.7128,
      'lng' => -74.0060,
      'timezone' => 'America/New_York',
    ],
    'cache' => [
      'ttl' => 60, // in minutes
    ],
    'icons' => [
      'mode' => 'preset', // preset | custom
      'path' => kirby()->root('index') . '/assets/moon-icons',
      'map' => [
        'new_moon' => 'new.svg',
        'waxing_crescent' => 'waxing-crescent.svg',
        'first_quarter' => 'first-quarter.svg',
        'waxing_gibbous' => 'waxing-gibbous.svg',
        'full_moon' => 'full.svg',
        'waning_gibbous' => 'waning-gibbous.svg',
        'last_quarter' => 'last-quarter.svg',
        'waning_crescent' => 'waning-crescent.svg',
      ],
    ],
  ],
];

Section

The plugin's custom Panel Section can be added to a blueprint and adopts any defined configuration options.

sections:
  moon:
    type: moon-phases
    title: Lunar Snapshot
    showIllumination: true
    precision: 1

Template Usage

You can use the following site helper methods in your templates. Use 1 or 0 to set the precision level of the values returned. moonIllumination() returns a percentage value, so 0 means whole-percent rounding.

<?= $site->moonPhase() ?>
<?= $site->moonPhaseLabel() ?>
<?= $site->moonIllumination(0) ?>
<?= $site->daysUntilNewMoon(1) ?>
<?= $site->daysUntilFullMoon(1) ?>

$site->moonPhaseIcon() returns an SVG string you can render in templates.

Convenience Snippet

A convenience snippet is provided to provide a simple HTML structure to wrap the above values and can be added to any template using:

<?php snippet('moon-phases') ?>

Disclaimer

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test before using it in a production environment. If you identify an issue, typo, etc, please create a new issue so I can investigate.

License

MIT

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固