Space Cat, Prince Among Thieves


SimpleCalendar is a very simple PHP calendar class written to be easy to use and flexible.

It includes basic event logic and is made to be modified to your particular needs.

Sample Usage

$calendar = new donatj\SimpleCalendar();


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

Example Calendar

Sample Event
Sample Event

Click here for the Github repository.

Recent Activity

Jesse Donat (donatj)

Updates docs

GitHub (web-flow)

Merge pull request #22 from donatj/8_2

Test in PHP 8.2

Jesse Donat (donatj)

Resolve PHP 8.1+ deprecation notice

GitHub (web-flow)

Test in PHP 8.2

Merge pull request #21 from donatj/dependabot/github_actions/actions/checkout-3

Bump actions/checkout from 2 to 3
Bump actions/checkout from 2 to 3

Bumps [actions/checkout]( from 2 to 3.
- [Release notes](
- [Changelog](
- [Commits](

- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major

Signed-off-by: dependabot[bot] <>
Create dependabot.yml

Update composer.json

Jesse Donat (donatj)

Clean up setCalendarClasses usage
Cleans up docs a pinch
Cleans up test a bit

GitHub (web-flow)

Merge pull request #18 from donatj/donatj-patch-1-1

Test in PHP 8.1
Test in PHP 8.1

Merge pull request #16 from donatj/donatj-patch-1

Create ci.yml

Jesse Donat (donatj)

Remove Travis
Compatible exception testing
Install the latest phpunit
Fix tests
Create ci.yml

GitHub (web-flow)

Delete FUNDING.yml

Moved to global .github repo

Create FUNDING.yml

Jesse Donat (donatj)

Removes unhelpful docs
Test exception
Cleans up / unifies interfaces
Improve addDailyHtml
Doc fixes

GitHub (web-flow)

Merge pull request #12 from donatj/1.x

1.x - Refactor / Rewrite

Jesse Donat (donatj)

Merge branch 'ben182-master' into 1.x
Merge branch 'master' of into ben182-master

# Conflicts:
#  lib/donatj/SimpleCalendar.php
 Updates docs
 Merge branch 'keesiemeijer-master'
 gitignore updates
 Simplified shrimp2ts work
Minor changes to enable selection of the previous/next months
First release by Trialog: add translation to French and improve rendering
 Merge pull request #2 from inod/patch-1

Added year check for today date
 Slight example cleanup
 Added the much requested ability to offset by days!
Fixed a nesting issue
Fixed a problem with the composer JSON
PSR-0, Composer
First tag in a long time, maintence build
Initial Release

Comment by: Joko Wandiro on

Joko Wandiro's Gravatar good PHP Class, very help me.
thanks a ton.

Comment by: joagido on

joagido's Gravatar what to do to start weeks on monday?

Comment by: Greg Duckworth on

Greg Duckworth's Gravatar This is a fantastic little script, although I don't suppose you could add the ability to move forward and back in months ?

Comment by: Jesse G. Donat on

Jesse G. Donat's Gravatar

The constructor on Simple Calendar takes a date string (see strtotime()) so an easy way is simply

$cal = new SimpleCalendar('+1 Month');


$cal = new SimpleCalendar('June 2012');

There is also a setDate method which allows you to change the date of the calendar after initial construction.

Comment by: Greg Duckworth on

Greg Duckworth's Gravatar Thanks, have it all working now.

Kudos again on the script!

Comment by: HvToor on

HvToor's Gravatar It looks great but when I download v0.3.2 and upload it to my website it won't work. I already changed the paths of the files to the right folder.

Hope you can help with it,

Comment by: Jesse G. Donat on

Jesse G. Donat's Gravatar Starting with .3.0 it is namespaced and requires PHP 5.3+, I'm sorry I did not update the documentation until just now. The example in the source code better illustrates this.

Comment by: Dirk on

Dirk's Gravatar As somebody already asked: Is there a simple way to make weeks start on mondays?

Thx in advance

Comment by: Vincent on

Vincent's Gravatar How to change the first day of the week is detailed in the 'sample usage'...

Comment by: Dirk on

Dirk's Gravatar $calendar->setStartOfWeek('Sunday');

works perfectly.

Thanks for the update! :)

Comment by: Alberto on

Alberto's Gravatar i keep getting the following notice Undefined offset: 1 to 31

"Notice: Undefined offset: 1 in SimpleCalendar.php on line 150"

Comment by: murali on

murali's Gravatar I used this calendar script in my website. I need to have the extended dates of next month and previous month in the current month. Please help me to do it in this calendar script. I would appreciate any help on this.


Comment by: Guilherme on

Guilherme's Gravatar NICE !!! VERY NICE CLASS !

To change the header,

Sun Mon Tue Wed Thu Fri Sat

To other languages ? what should i do ?



Comment by: Brad Haizlett on

Brad Haizlett's Gravatar Is there any way to enable previous and next month functionality on it? That would be awesome if you had that, or at least a way to have that working.

Comment by: Jesse G. Donat on

Jesse G. Donat's Gravatar Do you mean just rendering the next/previous month? That's as simple as:
$calendar = new donatj\SimpleCalendar();

$calendar->setDate('last month');

$calendar->setDate('next month');
If you mean button's for next/previous month, thats outside the scope. This is just a little widget to render a calendar. You can write JavaScript or PHP to do it yourself though without too much trouble.

Comment by: Mike on

Mike's Gravatar Any chance to provide code to display weekly view

Comment by: Peter on

Peter's Gravatar Good class! Thank you.

One question, regarding this line:

$out .= "\n" . ($i != $count ? '' : '');

Why did you check ($i != $count?)

In this way, one TR - start is missed.


Comment by: Anthony on

Anthony's Gravatar Concerning buttons for next/previous months. I understand you said its outside the scope but it would be really helpful if you could help out with it as its a bit cumbersome when trying to figure out the correct code to do it.

If you have update please put it out there.

Comment by: kalle on

kalle's Gravatar How do you make the calendar show current week only?

Comment by: kalle on

kalle's Gravatar I also get this error when downloaded the latest version.

Parse error: syntax error, unexpected T_STRING in C:\wamp\www\calendar\donatj\SimpleCalendar.php on line 3

Comment by: Greg on

Greg's Gravatar Any way to make it so you can click on a day and have it call a function to set an event for that day?

Comment by: Chris Yates on

Chris Yates's Gravatar Cracking little calendar nice & simple ...
I've incorporated this in a pretty complex ERP system and it works great and is easy to expand on

Comment by: Jose Vivas on

Jose Vivas's Gravatar Can you fill in the blanks with the dates of the previous month and the following month?

Comment by: rassloff on

rassloff's Gravatar thanks for sharing.

Email address will never be publicly visible.

See my Tweet about comment formatting.