Download the PHP package yohang/calendr without Composer
On this page you can find all versions of the php package yohang/calendr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yohang/calendr
More information about yohang/calendr
Files in yohang/calendr
Package calendr
Short Description Object Oriented calendar management
License MIT
Homepage https://github.com/yohang/CalendR
Informations about the package 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.
✨ Features
- Object-Oriented Periods: Manipulate
Year,Month,Week,Dayas objects, not strings or timestamps. - Fully Iterable: Iterate over a Year to get Months, or a Month to get Days, using native
foreachloops. - 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
🚀 Usage
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).
2. Working with Periods
Every period object implements PeriodInterface, providing powerful methods:
3. Managing Events
CalendR can attach events to any period. You need to configure an EventManager with one or more ProviderInterface.
Implement your Event
Create a Provider
Retrieve Events
🧩 Symfony & Twig Integration
If you use Symfony, the bundle is automatically configured.
Twig Functions
You can access periods directly in your templates: