Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olivernybroe/laracalendar
Recurring calendar events for Laravel
https://github.com/olivernybroe/laracalendar
calendar laravel laravel-package laravel5 laravel55 php
Last synced: 2 months ago
JSON representation
Recurring calendar events for Laravel
- Host: GitHub
- URL: https://github.com/olivernybroe/laracalendar
- Owner: olivernybroe
- License: mit
- Created: 2017-09-13T15:01:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-14T14:28:20.000Z (over 6 years ago)
- Last Synced: 2024-10-11T11:02:19.433Z (2 months ago)
- Topics: calendar, laravel, laravel-package, laravel5, laravel55, php
- Language: PHP
- Homepage:
- Size: 86.9 KB
- Stars: 17
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- Contributing: contributing.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/olivernybroe/LaraCalendar.svg?branch=master)](https://travis-ci.org/olivernybroe/LaraCalendar)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Latest Stable Version](https://poser.pugx.org/uruloke/lara-calendar/v/stable)](https://packagist.org/packages/uruloke/lara-calendar)
[![Total Downloads](https://poser.pugx.org/uruloke/lara-calendar/downloads)](https://packagist.org/packages/uruloke/lara-calendar)
[![codecov](https://codecov.io/gh/uruloke/LaraCalendar/branch/master/graph/badge.svg)](https://codecov.io/gh/uruloke/LaraCalendar)
[![StyleCI](https://styleci.io/repos/103414073/shield?branch=master)](https://styleci.io/repos/103414073)Documentation is still in development.
## Introduction
Building a calendar can be troublesome, especially when you deal with recurring events. This package tries to solve this problem by making an easy to use event builder with extensibility.The package is made for Laravel and uses Laravel Collections extensively.
For installing the package, just run and you are good to go.
```
$ composer require uruloke/lara-calendar
```
The service providers is autoloaded, so enjoy!## Example
Let's say we want to create an event which repeats every Monday, Tuesday, Wednesday and Thursday.
We can generate this simply by doing the following:```php
$builder = new EventBuilder();
$builder->startsAt(Carbon::parse("2017-09-05 08:00"));
$builder->endsAt(Carbon::parse("2017-09-05 18:00"));
$builder->weekly([Monday::class, Tuesday::class, Wednesday::class, Thursday::class]);// Dump the results
$builder->getNextEvents(3)```
The dumped data for the next 3 events would then be:
```
Uruloke\LaraCalendar\EventCollection {#221
#items: array:3 [
0 => Uruloke\LaraCalendar\Models\Event {#225
#start: Uruloke\LaraCalendar\Carbon {#230
+"date": "2017-09-05 08:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
#ends: Uruloke\LaraCalendar\Carbon {#231
+"date": "2017-09-05 18:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
}
1 => Uruloke\LaraCalendar\Models\Event {#232
#start: Uruloke\LaraCalendar\Carbon {#233
+"date": "2017-09-06 08:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
#ends: Uruloke\LaraCalendar\Carbon {#234
+"date": "2017-09-06 18:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
}
2 => Uruloke\LaraCalendar\Models\Event {#235
#start: Uruloke\LaraCalendar\Carbon {#236
+"date": "2017-09-07 08:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
#ends: Uruloke\LaraCalendar\Carbon {#237
+"date": "2017-09-07 18:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
}
]
}
```
## Recurrences### Weekly
### BiWeekly
### EvenWeeks
### UnevenWeeks
## Filters
### Filter days out
There might be a specific day which you want to blacklist from your event. This can be achieved by using the `withoutDay` method.
Just parse in a day and it will ignore that specific day.```
$builder = new EventBuilder();
$builder->startsAt(Carbon::parse("2017-09-05 08:00"));
$builder->endsAt(Carbon::parse("2017-09-05 18:00"));
$builder->allWeekDays();
$builder->withoutDay(Carbon::parse("2017-09-07"));
```