Skip to content

PHP iterators for simple calendar traversal.

License

Notifications You must be signed in to change notification settings

haldayne/calendar-iterator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haldayne\CalendarIterator

PHP iterators for simple calendar traversal.

Example

Choose an iterator, construct with your date range, and iterate!

use Haldayne\CalendarIterator\DayIterator;

$days = new DayIterator('today', 'next Monday');
foreach ($days as $day) {
    echo $day;
}

A wide selection of iterators:

  • \Haldayne\CalendarIterator\YearIterator
  • \Haldayne\CalendarIterator\MonthIterator
  • \Haldayne\CalendarIterator\WeekIterator
  • \Haldayne\CalendarIterator\DayIterator
  • \Haldayne\CalendarIterator\HourIterator
  • \Haldayne\CalendarIterator\MinuteIterator
  • \Haldayne\CalendarIterator\SecondIterator

Configure iterators to fit your need:

use Haldayne\CalendarIterator\DayIterator;

$days = new DayIterator('2013-01-01', '2013-12-31');
$days->addExclusion(easter_date(2013));
foreach ($days as $day) {
    echo $day;
}

Installation with Composer

php composer.phar require haldayne/calendar-iterator ^0.1.0

About

PHP iterators for simple calendar traversal.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages