2017 © Pedro Peláez
 

library simplecalendar

A light, easy to use calendar rendering library

image

donatj/simplecalendar

A light, easy to use calendar rendering library

  • Wednesday, December 6, 2017
  • by donatj
  • Repository
  • 12 Watchers
  • 49 Stars
  • 3,502 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 32 Forks
  • 4 Open issues
  • 14 Versions
  • 11 % Grown

The README.md

Simple Calendar

Latest Stable Version License ci.yml, (*1)

A very simple, easy to use PHP calendar rendering class., (*2)

Requirements

  • php: >=7.2
  • ext-calendar: *

Installing

Install the latest version with:, (*3)

composer require 'donatj/simplecalendar'

Examples

<?php

require '../vendor/autoload.php';

echo '<link rel="stylesheet" href="../src/css/SimpleCalendar.css" />';

$calendar = new donatj\SimpleCalendar('June 2010');

echo $calendar->render();

<?php
require '../vendor/autoload.php';

echo '<link rel="stylesheet" href="../src/css/SimpleCalendar.css" />';

$calendar = new donatj\SimpleCalendar;

$calendar->setStartOfWeek('Sunday');
$calendar->addDailyHtml('Sample Event', 'today', 'tomorrow');

$calendar->setWeekDayNames([ 'Sun', 'Mon', 'Tu', 'W', 'Th', 'F', 'Sa' ]);
$calendar->setStartOfWeek('Monday');

echo $calendar->render();

Documentation

Class: \donatj\SimpleCalendar

Simple Calendar, (*4)

Method: SimpleCalendar->__construct

function __construct([ $calendarDate = null [, $today = null]])
Parameters:
  • \DateTimeInterface | int | string | null $calendarDate
  • \DateTimeInterface | false | int | string | null $today

Method: SimpleCalendar->setDate

function setDate([ $date = null]) : void

Sets the date for the calendar., (*5)

Parameters:
  • \DateTimeInterface | int | string | null $date - DateTimeInterface or Date string parsed by strtotime for the calendar date. If null set to current timestamp.

Throws: \Exception, (*6)


Method: SimpleCalendar->setCalendarClasses

function setCalendarClasses(array $classes) : void

Sets the class names used in the calendar, (*7)

[  
   'calendar'     => 'SimpleCalendar',  
   'leading_day'  => 'SCprefix',  
   'trailing_day' => 'SCsuffix',  
   'today'        => 'today',  
   'event'        => 'event',  
   'events'       => 'events',  
]  
Parameters:
  • arraystring,string $classes - Map of element to class names used by the calendar.

Method: SimpleCalendar->setToday

function setToday([ $today = null]) : void

Sets "today"'s date. Defaults to today., (*8)

Parameters:
  • \DateTimeInterface | false | int | string | null $today - null will default to today, false will disable the rendering of Today.

Throws: \Exception, (*9)


Method: SimpleCalendar->setWeekDayNames

function setWeekDayNames([ ?array $weekDayNames = null]) : void
Parameters:
  • string[] | null $weekDayNames

Method: SimpleCalendar->addDailyHtml

function addDailyHtml(string $html, $startDate [, $endDate = null]) : void

Add a daily event to the calendar, (*10)

Parameters:
  • string $html - The raw HTML to place on the calendar for this event
  • \DateTimeInterface | int | string $startDate - Date string for when the event starts
  • \DateTimeInterface | int | string | null $endDate - Date string for when the event ends. Defaults to start date

Throws: \Exception, (*11)


Method: SimpleCalendar->clearDailyHtml

function clearDailyHtml() : void

Clear all daily events for the calendar, (*12)


Method: SimpleCalendar->setStartOfWeek

function setStartOfWeek($offset) : void

Sets the first day of the week, (*13)

Parameters:
  • int | string $offset - Day the week starts on. ex: "Monday" or 0-6 where 0 is Sunday

Method: SimpleCalendar->show

function show([ bool $echo = true]) : string

Returns/Outputs the Calendar, (*14)

DEPRECATED

Use render() method instead., (*15)

Parameters:
  • bool $echo - Whether to echo resulting calendar
Returns:
  • string - HTML of the Calendar

Method: SimpleCalendar->render

function render() : string

Returns the generated Calendar, (*16)

The Versions

06/12 2017

dev-master

9999999-dev http://donatstudios.com/SimpleCalendar

A light, easy to use calendar rendering library

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-calendar *

 

The Development Requires

calendar

07/06 2017

v0.6.2

0.6.2.0 http://donatstudios.com/SimpleCalendar

A light, easy to use calendar rendering library

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-calendar *

 

The Development Requires

calendar

16/04 2014

v0.6.1

0.6.1.0 http://donatstudios.com/SimpleCalendar

A light, easy to use calendar rendering library

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-calendar *

 

calendar

16/04 2014

v0.6.0

0.6.0.0 http://donatstudios.com/SimpleCalendar

A light, easy to use calendar rendering library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

calendar

06/01 2014

dev-patch-1

dev-patch-1 https://github.com/trialog/SimpleCalendar

A light easy to use calendar rendering library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

calendar

06/01 2014

1.x-dev

1.9999999.9999999.9999999-dev http://donatstudios.com/SimpleCalendar

A light, easy to use calendar rendering library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

calendar

06/01 2014

v0.5.1

0.5.1.0 https://github.com/trialog/SimpleCalendar

A light easy to use calendar rendering library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

calendar

03/01 2014

v0.5.0

0.5.0.0 https://github.com/trialog/SimpleCalendar

A light easy to use calendar rendering library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

calendar

20/09 2013

v0.4.2

0.4.2.0 http://donatstudios.com/SimpleCalendar

A very simple calendar library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

calendar

23/05 2013

v0.4.1

0.4.1.0 http://donatstudios.com/SimpleCalendar

A very simple calendar library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

calendar

17/05 2013

v0.4.0

0.4.0.0 http://donatstudios.com/SimpleCalendar

A very simple calendar library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

calendar

12/03 2013

v0.3.2

0.3.2.0 http://donatstudios.com/SimpleCalendar

A very simple calendar library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

calendar

12/03 2013

v0.3.1

0.3.1.0 http://donatstudios.com/SimpleCalendar

A very simple calendar library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

calendar

12/03 2013

v0.3.0

0.3.0.0 http://donatstudios.com/SimpleCalendar

A very simple calendar library

  Sources   Download

MIT

The Requires

  • php >=5.1.0

 

calendar