phil / almanac-bundle
phil/almanac in Symfony: computed dates declared in configuration or kept in the database for an administrator, the almanac as a service, its form, its dates, eclipses and the sunrise and sunset of configured places in Twig
Package info
github.com/parler-haut-interagir-librement/almanac-bundle
Type:symfony-bundle
pkg:composer/phil/almanac-bundle
Requires
- php: >=8.5
- ext-mbstring: *
- phil/almanac: ^0.1@dev
- symfony/config: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/form: ^8.2
- symfony/http-kernel: ^8.2
- symfony/options-resolver: ^8.2
- symfony/validator: ^8.2
Requires (Dev)
- doctrine/dbal: ^4.5
- doctrine/doctrine-bundle: ^3.3
- doctrine/orm: ^3.7
- doctrine/persistence: ^4.1
- phpunit/phpunit: ^13.4
- psr/log: ^3.0
- symfony/event-dispatcher: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/translation: ^8.2
- symfony/twig-bridge: ^8.2
- symfony/twig-bundle: ^8.2
- symfony/uid: ^8.2
- twig/twig: ^3.21
Suggests
- doctrine/orm: To keep dates in the database, with symfony/uid
- twig/twig: For almanac_dates
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-12 23:51:03 UTC
README
Holidays and computed dates declared in configuration, editable by an administrator, shown in Twig.
phil/almanac-bundle brings phil/almanac into a Symfony application. Dates are declared in configuration, such as
Thanksgiving, 2nd monday of october or Mardi Gras, easter - 47 days, and computed in the time zone the
configuration gives. The almanac is a service, built from those dates each time it is asked for. almanac_dates
gives the dates of a period in Twig, sun_times the sunrise, sunset and twilights of a configured place, and
almanac_eclipses the solar and lunar eclipses, which eclipses: true also declares as dates. Labels and messages
come in English and French.
It is for a site that shows holidays and seasonal dates next to its own content. When the application wants it, dates
are also kept in a Doctrine table, so an administrator adds or changes one through StoredDateType without a
deployment. A stored date replaces the configured date of the same key. A row whose rule cannot be read is left out,
so one bad row does not stop every page. Reach for phil/almanac alone outside Symfony. phil/calendar-bundle shows
these dates among its events.
The stored dates sit behind the StoredDateRepository port, with DoctrineStoredDateRepository as its adapter,
switched on by database: true. Doctrine ORM and Twig are optional: the Twig function is registered only when Twig is
installed.
Status
| Part | State |
|---|---|
phil_almanac: time zone, dates read at build |
Implemented and tested |
Stored dates: StoredDate, DoctrineStoredDateRepository, replacing configured ones |
Implemented and tested |
The service Phil\Almanac\Almanac |
Implemented and tested |
StoredDateType and DateDraft |
Implemented and tested |
Twig: almanac_dates |
Implemented and tested |
Eclipses declared as dates; places; Twig: sun_times, almanac_eclipses |
Implemented and tested |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements and registering. |
| Configuration | The time zone, the dates, the eclipses and the places. |
| Stored dates and the form | The table, the repository, the form and its validation. |
| Twig | almanac_dates, sun_times, almanac_eclipses. |
| Extension points | What an application implements, configures, replaces or relies on. |
| Testing | How the bundle is tested. |
| Reference | Every type and service of the bundle. |
Quick start
phil_almanac: timezone: America/Toronto dates: thanksgiving: { title: Action de grâce, rule: 2nd monday of october, tags: [holiday] } full-moon: { title: Pleine lune, rule: full moon, all_day: false }
{% for date in almanac_dates('2026-10-01', '2026-11-01') %}
{{ date.definition.title }} — {{ date.span.start|date('Y-m-d') }}
{% endfor %}
Requirements
PHP 8.5 or later with ext-mbstring; phil/almanac 0.1; Symfony 8.2's config, dependency injection, form, HTTP kernel, options resolver
and validator. Doctrine ORM with symfony/uid, for stored dates, and Twig are optional.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.