https://github.com/10quality/php-calendar
PHP calendar handler class.
https://github.com/10quality/php-calendar
Last synced: 9 months ago
JSON representation
PHP calendar handler class.
- Host: GitHub
- URL: https://github.com/10quality/php-calendar
- Owner: 10quality
- License: mit
- Created: 2017-02-22T23:40:20.000Z (over 9 years ago)
- Default Branch: v1.0
- Last Pushed: 2019-05-27T00:51:28.000Z (about 7 years ago)
- Last Synced: 2025-09-18T18:29:31.317Z (9 months ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Calendar (PHP class)
[](https://packagist.org/packages/10quality/php-calendar)
[](https://packagist.org/packages/10quality/php-calendar)
[](https://packagist.org/packages/10quality/php-calendar)
Calendar handler library for PHP.
**NOTE:** This class will not echo / print the calendar.
Features:
* Handles monthly weeks and days.
* Ability to attach data.
* Able to be render in any custom template.
## Installation
With composer, make the dependecy required in your project:
```bash
composer require 10quality/php-calendar
```
## Usage
The following example will build the calendar for the current month:
```php
use TenQuality\Utility\Calendar;
$calendar = new Calendar();
$calendar->build();
```
### Attaching data
```php
// Example
$data = array();
$data[] = $obj; // Either ARRAY or OBJECT
$calendar = new Calendar();
$calendar->data = $data;
// Array column or object filed containing the date related to each data row
$calendar->dataDateFiled = 'dateCreated';
// Build
$calendar->build();
```
### Printing
Printing example:
```html
headers as $header) : ?>
weeks as $week) : ?>
days as $day) : ?>
number ?>
data as $row) : ?>
```
### Other properties or methods
Build calendar for a specific date:
```php
$calendar = new Calendar('2017-01-25');
$calendar->build();
```
Get previous and next month dates:
```php
$calendar = new Calendar('2017-01-25');
$calendar->nextMonthDate;
$calendar->prevMonthDate;
```
## Coding guidelines
PSR-4.
## LICENSE
The MIT License (MIT)
Copyright (c) 2017 [10Quality](http://www.10quality.com).