Download the PHP package codryn/phpcalendar without Composer
On this page you can find all versions of the php package codryn/phpcalendar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phpcalendar
PHPCalendar
RPG Calendar System for PHP - Gregorian & Fantasy Calendars with Internationalization
PHPCalendar is a powerful, type-safe calendar system for PHP supporting both real-world (Gregorian) and fantasy setting calendars. Perfect for RPG applications, game development, and custom calendar implementations.
Features
- ποΈ Built-in Calendar Profiles: Gregorian + fantasy RPG calendars (FaerΓ»n, Golarion, DSA, Eberron, Dragonlance, Greyhawk, ...)
- π Calendar Mapping: Convert dates between different calendar systems with correlation dates and optional valid ranges
- π Internationalization: Support for different languages (English, German, French, Spanish, Italian, ...) for month names, epochs, and calendar names
- π Flexible Date Parsing: Parse dates from natural language and various formats
- π¨ Customizable Formatting: Format dates with custom patterns
- β±οΈ Date Arithmetic: Add/subtract time spans, calculate differences between dates
- π― Custom Calendar Support: Create your own calendars with custom months, days, and leap year rules
- β Error Handling: Clear, specific error messages with location information
- π Type Safe: Full PHP 8.1+ type declarations and strict mode
- β‘ Zero Dependencies: Pure PHP 8.1+ implementation using only stdlib
- π§ͺ Well Tested: Unit tests with comprehensive coverage
- π¦ PSR-12 Compliant: Modern PHP coding standards
Requirements
- PHP 8.1 or higher
- No additional PHP extensions required
Installation
Quick Start and Usage
Calendar Mapping and Conversion
Convert dates between different calendar systems:
Internationalization
PHPCalendar supports internationalization for all built-in calendar profiles. Calendar names, month names, epoch notations, and nameless day names can be displayed in 5 languages:
- en-us (English - default)
- de (German)
- fr (French)
- es (Spanish)
- it (Italian)
Usage
Supported Translations
| Calendar | Month Names | Display Name | Epoch Notation | Nameless Days |
|---|---|---|---|---|
| Gregorian | β All 5 | β All 5 | β All 5 | N/A |
| FaerΓ»n | Proper nouns* | β All 5 | β All 5 | β All 5 |
| DSA | Proper nouns* | β All 5 | β All 5 | β All 5 |
| Dragonlance | β All 5 | β All 5 | β All 5 | N/A |
| Eberron | Proper nouns* | β All 5 | β All 5 | N/A |
| Golarion | Proper nouns* | β All 5 | β All 5 | N/A |
| Greyhawk | β All 5 | β All 5 | β All 5 | N/A |
*Proper nouns (fantasy deity names, dragonmarks, etc.) remain untranslated across all languages.
Locale Fallback
If an unsupported or invalid locale is provided, the system automatically falls back to English (en-us):
Calendar Profiles
Gregorian Calendar
Standard international calendar with proper leap year rules.
Specifications:
- 12 months with varying days (28-31)
- Leap year: Divisible by 4, except centuries unless divisible by 400
- Epoch: BCE/CE
FaerΓ»n (Forgotten Realms)
Harptos calendar from D&D's Forgotten Realms setting.
Specifications:
- 12 regular months (30 days each) + 5 festival days
- Leap year: Every 4 years (Shieldmeet)
- Epoch: DR (Dale Reckoning)
- Total: 365 days (366 with Shieldmeet)
Golarion (Pathfinder)
Absalom Reckoning calendar from Pathfinder RPG.
Specifications:
- 12 months with varying days (28-31)
- Leap year: Every 8 years
- Epoch: AR (Absalom Reckoning)
- Total: 365 days (366 in leap years)
Das Schwarze Auge
Aventurian calendar from The Dark Eye RPG.
Specifications:
- 12 months (30 days each) + 5 nameless days
- No leap years
- Epoch: BF (Bosparans Fall)
- Total: 365 days always
Eberron
Galifar Calendar from D&D's Eberron setting.
Specifications:
- 12 months of exactly 28 days each
- No leap years
- Epoch: YK (Years of Kingdom)
- Total: 336 days
Dragonlance
Krynn calendar from D&D's Dragonlance setting.
Specifications:
- 12 months with varying days (28-31)
- Leap year: Gregorian rules
- Epoch: PC/AC (Pre/After Cataclysm)
- Total: 365 days (366 in leap years)
Greyhawk
Common Year calendar from D&D's World of Greyhawk.
Specifications:
- 12 months (28 days each) + 4 festival weeks (7 days each)
- No leap years
- Epoch: CY (Common Year)
- Total: 364 days
Custom Calendars
Create your own calendar with custom configuration:
API Reference
PHPCalendar provides a clean, fluent API for calendar operations:
Documentation
Comprehensive documentation is available:
- API Documentation - Complete class and method reference
- Usage Guide - Common patterns and examples
- Calendar Profiles - Details on all 7 built-in profiles
- Calendar Mapping - Convert dates between calendar systems
- Custom Calendars - Guide to creating custom calendars
- Contributing Guide - Development workflow and standards
Development
See CONTRIBUTING.md for development guidelines.
Architecture
PHPCalendar is structured around key components:
- Calendar: Main class for calendar operations
- CalendarProfile: Defines calendar rules and metadata
- TimePoint: Represents specific dates in a calendar
- TimeSpan: Represents time intervals for date arithmetic
Performance
TODO: Add performance benchmarks and optimizations.
Quality Standards
- β PHPStan Level 10: Strictest static analysis level from PHPSTan 2.1
- β PSR-12: PHP coding standards compliance
- β
Strict Types:
declare(strict_types=1)in all files - β TDD: Test-driven development methodology
- β Type Hints: Full type declarations on all methods
- β PHPDoc: Complete documentation blocks
Contributing
Contributions are welcome! See CONTRIBUTING.md for:
- Development workflow
- Coding standards
- Testing requirements
- Pull request process
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG.md for version history and updates.
Support
- π Documentation
- π Issue Tracker
- π¬ Discussions
- π§ Email
Credits
Created and maintained by Marco for Codryn.
Special thanks to:
- The PHP community
- Contributors to fantasy RPG calendar systems
- PHPUnit, PHPStan, and PHP-CS-Fixer maintainers
Game Systems Copyright
This library implements calendars from various tabletop RPG systems for non-commercial use. All game system names, mechanics, and related intellectual property remain the property of their respective copyright holders. See GAME_SYSTEMS_COPYRIGHT.md for detailed copyright notices and attributions.
Built for the tabletop RPG community π²