PHPackages                             sugarcraft/sugar-calendar - 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. sugarcraft/sugar-calendar

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

sugarcraft/sugar-calendar
=========================

PHP port of EthanEFung/bubble-datepicker — interactive date picker component for terminal UIs. Supports month/year navigation, keyboard navigation, date selection with visual cursor, and customizable styling.

00PHP

Since Jun 1Pushed 1w agoCompare

[ Source](https://github.com/sugarcraft/sugar-calendar)[ Packagist](https://packagist.org/packages/sugarcraft/sugar-calendar)[ RSS](/packages/sugarcraft-sugar-calendar/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![sugar-calendar](.assets/icon.png)](.assets/icon.png)

[![CI](https://github.com/detain/sugarcraft/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/detain/sugarcraft/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/f99446455a46eb32d3accb784092de8f3f9e4a9b0ae829fc12d3633fe6052a35/68747470733a2f2f636f6465636f762e696f2f67682f64657461696e2f737567617263726166742f6272616e63682f6d61737465722f67726170682f62616467652e7376673f666c61673d73756761722d63616c656e646172)](https://app.codecov.io/gh/detain/sugarcraft?flags%5B0%5D=sugar-calendar)[![Packagist Version](https://camo.githubusercontent.com/d2f15c69385c39f37dc2fb3f7ed92f9ae55886e3e91cd07dd037a3664e0b69f2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7375676172636f72652f73756761722d63616c656e6461723f6c6162656c3d7061636b6167697374)](https://packagist.org/packages/sugarcore/sugar-calendar)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/e78ffc83837c0d12647811a7fd1910c3cbeae04988de94bb4fd5b67e0874696a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d254532253839254135382e312d3838393262662e737667)](https://www.php.net/)

SugarCalendar
=============

[](#sugarcalendar)

PHP port of [EthanEFung/bubble-datepicker](https://github.com/EthanEFung/bubble-datepicker) — interactive date picker component for terminal UIs. Inspired by the jQuery Datepicker widget.

Features
--------

[](#features)

- **Month/year navigation** — prev/next buttons, year select
- **Keyboard navigation** — arrow keys, Enter to select, Esc to close
- **Date selection** — select/clear a date, visual cursor
- **Today highlight** — show current date distinctly
- **Selected date styling** — clear visual indicator
- **Pure renderer** — outputs ANSI strings, no external TUI framework needed

Install
-------

[](#install)

```
composer require sugarcraft/sugar-calendar
```

Quick Start
-----------

[](#quick-start)

```
use SugarCraft\Calendar\Model;
use SugarCraft\Calendar\DatePicker;

$picker = DatePicker::new(new \DateTimeImmutable('2026-05-01'));
$picker = $picker->SelectDate();  // enter "select mode"

echo $picker->View();  // render calendar
```

Navigation
----------

[](#navigation)

```
// Month navigation
$picker = $picker->GoToPreviousMonth();
$picker = $picker->GoToNextMonth();
$picker = $picker->GoToPreviousYear();
$picker = $picker->GoToNextYear();
$picker = $picker->GoToToday();

// Set arbitrary month
$picker = $picker->SetTime(new \DateTimeImmutable('2025-12-01'));

// Selection
$picker = $picker->SelectDate();   // confirm selection
$picker = $picker->ClearDate();    // clear selection
```

Keyboard Handling
-----------------

[](#keyboard-handling)

Handle keyboard input by calling the appropriate move methods:

```
if ($key === 'left')  $picker = $picker->MoveCursorLeft();
if ($key === 'right') $picker = $picker->MoveCursorRight();
if ($key === 'up')    $picker = $picker->MoveCursorUp();
if ($key === 'down')  $picker = $picker->MoveCursorDown();
if ($key === 'enter') $picker = $picker->SelectDate();
if ($key === 'esc')   $picker = $picker->ClearDate();
```

Shared foundations
------------------

[](#shared-foundations)

- **[candy-buffer](https://github.com/sugarcraft/candy-buffer)** — month grid rendered as a 7-column × N-row `Buffer`; events placed into target cells; `Buffer::toAnsi()` produces canonical ANSI SGR output.
- **[candy-testing](https://github.com/sugarcraft/candy-testing)** — golden-file snapshot tests via `assertGoldenAnsi()` pin canonical month layouts.

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

20

↑

LowBetter than 13% of packages

Maintenance64

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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/b1036e0717211b8030b83cbe729e8ba6ba442fdbd5285fb97a39d7dcfe339342?d=identicon)[detain](/maintainers/detain)

---

Top Contributors

[![detain](https://avatars.githubusercontent.com/u/1364504?v=4)](https://github.com/detain "detain (57 commits)")

### Embed Badge

![Health badge](/badges/sugarcraft-sugar-calendar/health.svg)

```
[![Health](https://phpackages.com/badges/sugarcraft-sugar-calendar/health.svg)](https://phpackages.com/packages/sugarcraft-sugar-calendar)
```

###  Alternatives

[matomo/network

211.1M18](/packages/matomo-network)

PHPackages © 2026

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