PHPackages                             yohang/calendr - 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. yohang/calendr

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

yohang/calendr
==============

Object Oriented calendar management

4.0.0(5mo ago)465614.1k↓24.2%66[10 issues](https://github.com/yohang/CalendR/issues)[1 PRs](https://github.com/yohang/CalendR/pulls)3MITPHPPHP &gt;=8.2CI passing

Since Feb 15Pushed 5mo ago24 watchersCompare

[ Source](https://github.com/yohang/CalendR)[ Packagist](https://packagist.org/packages/yohang/calendr)[ Docs](https://github.com/yohang/CalendR)[ RSS](/packages/yohang-calendr/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (18)Versions (28)Used By (3)

CalendR
=======

[](#calendr)

**A modern, object-oriented calendar management library for PHP 8.2+.**

CalendR provides a clean, immutable, and iterable API to manipulate time periods (Years, Months, Weeks, Days...) and manage associated events.

[![CI Status](https://github.com/yohang/CalendR/actions/workflows/ci.yml/badge.svg)](https://github.com/yohang/CalendR/actions/workflows/ci.yml)[![Coverage Status](https://camo.githubusercontent.com/609f6b598323a20771ce76fc8d7ce1a48e842d00ca0b33153f988b88f6fdc1cf/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f796f68616e672f43616c656e64522f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/yohang/CalendR?branch=main)[![Mutation testing badge](https://camo.githubusercontent.com/70403a5723ca9cc784fb808b20c07374a88aecd88db003c32681b7e18fbb856d/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246796f68616e6725324643616c656e64522532466d61696e)](https://dashboard.stryker-mutator.io/reports/github.com/yohang/CalendR/main)

✨ Features
----------

[](#-features)

- **Object-Oriented Periods:** Manipulate `Year`, `Month`, `Week`, `Day` as objects, not strings or timestamps.
- **Fully Iterable:** Iterate over a Year to get Months, or a Month to get Days, using native `foreach` loops.
- **Immutable by Design:** Based on `DateTimeImmutable`, ensuring safe date manipulations.
- **Event Management:** Fetch and aggregate events from multiple sources (Doctrine, API, etc.) for any period.
- **Zero Dependencies:** The core library has no external dependencies.
- **Framework Integrations:** Includes a Symfony Bundle and Twig extensions.

📦 Installation
--------------

[](#-installation)

```
composer require yohang/calendr
```

🚀 Usage
-------

[](#-usage)

### 1. Navigating Time

[](#1-navigating-time)

The Calendar class is your main entry point. It acts as a factory to create periods configured with your preferences (e.g., first day of the week).

```
