dipesh/calendar 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dipesh/calendar

Composer 安装命令:

composer require dipesh/calendar

包简介

A PHP package that builds a complete Nepali calendar effortlessly, serving as a wrapper around the dipesh/nepali-date package. It allows users to generate and manipulate a full Nepali calendar, add events, and perform date calculations without any prior knowledge of the underlying system.

README 文档

README

Laravel Logo

Nepali Calendar

The Nepali Calendar is a comprehensive PHP package for generating and managing a Nepali calendar. It acts as a wrapper for the dipesh/nepali-date package, enabling users to easily create a full Nepali calendar and manage events within it, all without needing extensive knowledge of the Nepali date system.

Features

  • Comprehensive Nepali Calendar: Generate and work with a complete Nepali calendar.
  • Event Management: Add, update, and manage events for each day.
  • Dynamic Event Handling: Add events using callables or arrays, allowing integration with databases or other sources.
  • Intuitive Navigation: Simple methods for navigating months and years.

Installation

To install the Nepali Calendar package, use Composer:

composer require dipesh/calendar

Usage

Basic Setup

Create a new calendar instance. By default, it initializes to the current date, but you can provide a specific date if needed.

use Dipesh\Calendar\Calendar;

// Create a new calendar instance with the current date
$calendar = new Calendar();

// Create a new calendar instance with a specific date
$specificDate = '2079/01/01'; // Nepali date format
$calendar = new Calendar($specificDate);

Setting Events

Add events for specific days using the setEvent method. You can also set multiple events at once with the setEvents method.

Adding a Single Event

// Add a single event on the 1st of the month
$calendar->setEvent(1, 'New Year Celebration');

Adding Multiple Events

You can use an associative array of events or a callable function for dynamic event setting.

// Define an array of events
$events = [
    14 => 'Valentine\'s Day Celebration',
    28 => 'End of Month Gathering',
];

// Set multiple events at once
$calendar->setEvents($events);

Navigating the Calendar

Easily move through the months and years:

// Move to the next month
$calendar->nextMonth();

// Move to the previous month
$calendar->prevMonth();

// Move to the next year
$calendar->nextYear();

// Move to the previous year
$calendar->prevYear();

Using Callbacks for Dynamic Event Fetching

Define a callable function to fetch and set events dynamically, such as from a database.

// Function to fetch events from a database
$fetchEvents = function ($calendarInstance, $days) {
    // Simulated database fetch
    $dbEvents = [
        5 => 'Public Holiday',
        15 => 'Community Event',
    ];

    // Add events to the calendar
    foreach ($dbEvents as $day => $event) {
        $calendarInstance->setEvent($day, $event);
    }
};

// Set events using the callback function
$calendar->setEvents($fetchEvents);

Example Project

To help you get started with the Nepali Calendar package, an example project is available for you to download and inspect. This project demonstrates how to implement the calendar with event management features effectively.

Screenshot of Example Project

Example Project Screenshot

Download Example Project

You can download the example project from the following link:

Download Example Project

Contributing

Contributions are welcome! If you have suggestions, improvements, or bug fixes, please submit a pull request or open an issue.

License

This package is licensed under the MIT License. For more details, see the LICENSE file.

dipesh/calendar 适用场景与选型建议

dipesh/calendar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 46 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 08 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「date」 「calendar」 「Nepali Calendar」 「Nepali Date」 「nepalidate」 「nepalicalendar」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dipesh/calendar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dipesh/calendar 我们能提供哪些服务?
定制开发 / 二次开发

基于 dipesh/calendar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-11