https://github.com/seebaermichi/monthly-calendar
A package which provides a monthly calendar with days and events depending on given months and events.
https://github.com/seebaermichi/monthly-calendar
calendar php
Last synced: 10 months ago
JSON representation
A package which provides a monthly calendar with days and events depending on given months and events.
- Host: GitHub
- URL: https://github.com/seebaermichi/monthly-calendar
- Owner: seebaermichi
- License: mit
- Created: 2021-11-29T20:34:07.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-09T18:52:15.000Z (almost 3 years ago)
- Last Synced: 2025-07-25T23:42:04.208Z (12 months ago)
- Topics: calendar, php
- Language: PHP
- Homepage:
- Size: 47.9 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# A package which provides a monthly calendar with days and events depending on given months and events.
[](https://packagist.org/packages/seebaermichi/monthly-calendar)
[](https://github.com/seebaermichi/monthly-calendar/actions/workflows/run-tests.yml)
[](https://packagist.org/packages/seebaermichi/monthly-calendar)
This package returns a simple array with months, weeks and events depending on the months and events you provide.
## Installation
You can install the package via composer:
```bash
composer require seebaermichi/monthly-calendar
```
## Usage
```php
// Will return an array with the given months and their weeks and days
// weeks will start with Monday
$monthlyCalendar = new Seebaermichi\MonthlyCalendar(['December 2021', 'January 2022']);
$calendar = $monthlyCalendar->getCalendar();
// Will return an array with the given months and their weeks and days
// weeks will start with Sunday
$monthlyCalendar = new Seebaermichi\MonthlyCalendar(['February 1989', 'March 1989'], 'Sun');
$calendar = $monthlyCalendar->getCalendar();
// Provide simple array of events and event label to get related days labeled
// First of December will have an event attribute 'birthday'
$monthlyCalendar = new Seebaermichi\MonthlyCalendar(['December 2021']);
$calendar = $monthlyCalendar->getCalendar(['2021-12-01'], 'birthday');
// Provide array of events with detailed data to get related days labeled
// 6th of March 2023 will have an events array including the given data
$monthlyCalendar = new Seebaermichi\MonthlyCalendar(['December 2021']);
$givenEvents = [
[
'datetime' => '2023-06-03 10:00',
'label' => 'meeting',
],
[
'datetime' => '2023-06-03 13:00',
'label' => 'lunch',
],
];
$calendar = $monthlyCalendar->getCalendar($givenEvents, '', 'Y-m-d H:i');
// Get only weekdays array with optional $startWith day
$weekdays = Seebaermichi\MonthlyCalendar::weekdays(); // ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
$weekdays = Seebaermichi\MonthlyCalendar::weekdays('Sun'); // ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
```
## Testing
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Michael Becker](https://github.com/seebaermichi)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.