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)

Update docs

underscores to camel case

Badges added

Unessessary initialization removed
notice prevention

gitignore updates
Ever so slight documentation cleanup
gitignore updated
Generated documentation added
closes #1 ext-calendar requirement added
General documentation and cleanup
Simplified shrimp2ts work

shrimp2t (shrimp2t)

Fixed bug Sets the first day of Week

Jesse Donat (donatj)

Merge pull request #4 from bitdeli-chef/master

Add a Bitdeli Badge to README

Bitdeli Chef (bitdeli-chef)

Add a Bitdeli badge to README

Jesse Donat (donatj)


Update composer.json

Merge pull request #2 from inod/patch-1

Added year check for today date

inod (inod)

Added year check for today date

Jesse Donat (donatj)


You've gotta be kidding me... wtf. How did I do this twice?

This reverts commit 0e2e789da7df1fa5e21f0d9657e321d464c3d7f9.
Revert "Update"

This reverts commit 1bdea01ed92780fb820041a05a8c046f5592dc13.


Slight example cleanup
Fixed a couple notices thrown

Added the much requested ability to offset by days!
Example HTML cleanup
 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 Gravatargood PHP Class, very help me.
thanks a ton.

Comment by: joagido on

joagido Gravatarwhat to do to start weeks on monday?

Comment by: Greg Duckworth on

Greg Duckworth GravatarThis 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 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 GravatarThanks, have it all working now.

Kudos again on the script!

Comment by: HvToor on

HvToor GravatarIt 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 GravatarStarting 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 GravatarAs somebody already asked: Is there a simple way to make weeks start on mondays?

Thx in advance

Comment by: Vincent on

Vincent GravatarHow to change the first day of the week is detailed in the 'sample usage'...

Comment by: Dirk on

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

works perfectly.

Thanks for the update! :)

Comment by: Alberto on

Alberto Gravatari 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 GravatarI 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 GravatarNICE !!! 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 GravatarIs 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 Donat on

Jesse Donat GravatarDo 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 GravatarAny chance to provide code to display weekly view

Comment by: Peter on

Peter GravatarGood 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: Lesibe on

Lesibe Gravatarhow to set calender month title

Comment by: Anthony on

Anthony GravatarConcerning 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.

Email address will never be publicly visible.