Download the PHP package benhall14/php-calendar without Composer
On this page you can find all versions of the php package benhall14/php-calendar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-calendar
PHP Calendar
A PHP class that makes generating calendars as easy as possible.
You can use the addEvent() or addEvents() methods to mark events on the generated calendar.
This is fully compatible with PHP 5 through to PHP 8.1+
Installation via Composer
You can now install this class via composer.
$ composer require benhall14/php-calendar
Remember to add the composer autoloader before using the class and use the correct namespace.
require 'vendor/autoload.php';
use benhall14\phpCalendar\Calendar as Calendar;
Usage
Please make sure you have added the required classes.
Styling
You can apply styles in one of three ways:
1) Using $calendar->stylesheet() after you have initialised a calendar;
2) Using the calendar.css (or calendar.min.css) from the css directory;
3) Create your own stylesheet and add it to the head of your HTML document.
Draw a 'Month View' calendar
In its simplest form, use the following to create a calendar for current month. This will use all defaults (English, Week starting on Sunday, including stylesheet, printing to the page).
Or, you can break it down with full customisability:
Draw a 'Week View' calendar
Instead of a 'month view' calendar, you can now render as a 'week view'. To do this, simply use ->useWeekView(). Remember, when adding events to a week-view calendar, you need to include the time too (see events above).
You can change the start/end times of the day, along with the time interval by using the ->setTimeFormat method:
Monday Start Date
You can now change the weekly start date from a Sunday to a Monday. To activate this, simple use the useMondayStartingDate() method before you 'draw'.
Translated Calendars
We now ship with both English and Spanish translations, with more coming soon. Alternatively, you can add your own custom string translations for both the days and months using the following:
``
If you want to help with translations, use the code in the useSpanish() method as a guide, and open a pull-request.
Credits
Requirements
PHP DateTime
License
Copyright (c) 2016-2022 Benjamin Hall, [email protected] https://conobe.co.uk
Licensed under the MIT license
Donate?
If you find this project helpful or useful in any way, please consider getting me a cup of coffee - It's really appreciated :)