PHPackages                             fredbradley/annual-leave-widget - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. fredbradley/annual-leave-widget

ActiveLibrary[API Development](/categories/api)

fredbradley/annual-leave-widget
===============================

A Laravel package for displaying annual leave events from Google Calendar ICS feeds

v0.0.2(3w ago)04↓100%MITPHPPHP ^8.5CI passing

Since Apr 24Pushed 3w ago3 watchersCompare

[ Source](https://github.com/cranleighschool/annual-leave-dashboard-widget)[ Packagist](https://packagist.org/packages/fredbradley/annual-leave-widget)[ RSS](/packages/fredbradley-annual-leave-widget/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

Annual Leave Dashboard Widget
=============================

[](#annual-leave-dashboard-widget)

? A Laravel package for displaying annual leave events from Google Calendar ICS feeds in your Laravel 12/13 application.

Requirements
------------

[](#requirements)

- PHP 8.5+
- Laravel 12.x or 13.x

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require fredbradley/annual-leave-widget
```

The package will automatically register itself via Laravel's package auto-discovery.

Configuration
-------------

[](#configuration)

### 1. Publish the Configuration File (Optional)

[](#1-publish-the-configuration-file-optional)

If you want to customize the configuration, publish the config file:

```
php artisan vendor:publish --tag=annual-leave-config
```

This will create a `config/annual_leave.php` file in your application.

### 2. Add Your Google Calendar ICS URL

[](#2-add-your-google-calendar-ics-url)

Add your Google Calendar ICS URL to your `.env` file:

```
GOOGLE_CALENDAR_ICS_URI=https://calendar.google.com/calendar/ical/your-calendar-id/public/basic.ics
```

#### How to Get Your Google Calendar ICS URL

[](#how-to-get-your-google-calendar-ics-url)

1. Open Google Calendar
2. Click on the three dots next to the calendar you want to share
3. Select "Settings and sharing"
4. Scroll down to "Integrate calendar"
5. Copy the "Secret address in iCal format" URL

[![Getting iCal Link](https://camo.githubusercontent.com/f37f6b187928d4ce5e41a57f61efeeaa346d8738800b37b434628c6acbb1c79d/68747470733a2f2f737570706f72742e666f786272696768742e636f6d2f68632f61727469636c655f6174746163686d656e74732f3336303030303131363439332f6943616c5f6c696e6b5f616464726573732e706e67)](https://camo.githubusercontent.com/f37f6b187928d4ce5e41a57f61efeeaa346d8738800b37b434628c6acbb1c79d/68747470733a2f2f737570706f72742e666f786272696768742e636f6d2f68632f61727469636c655f6174746163686d656e74732f3336303030303131363439332f6943616c5f6c696e6b5f616464726573732e706e67)

### 3. Optional Environment Variables

[](#3-optional-environment-variables)

You can also configure the following in your `.env` file:

```
# Timezone for parsing calendar events (default: Europe/London)
ANNUAL_LEAVE_TIMEZONE=Europe/London

# Maximum number of events to display (default: 12)
ANNUAL_LEAVE_MAX_EVENTS=12
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Once installed and configured, the package automatically registers a route at `/annual-leave` that displays the widget.

Visit: `https://your-app.test/annual-leave`

### Custom Views

[](#custom-views)

If you want to customize the view, publish the views:

```
php artisan vendor:publish --tag=annual-leave-views
```

This will create views in `resources/views/vendor/annual-leave/` which you can customize.

### Using the Widget in Your Own Views

[](#using-the-widget-in-your-own-views)

You can also include the widget in your own views:

```
@include('annual-leave::widget', ['events' => $events])
```

To get the events in your controller:

```
use CranleighSchool\AnnualLeave\IcsParser;

public function myMethod()
{
    $parser = new IcsParser(config('annual_leave.google_calendar_ics_uri'));
    $events = $parser->parse();

    return view('your-view', compact('events'));
}
```

### JSON API Endpoint

[](#json-api-endpoint)

The package also provides a JSON API endpoint for consuming applications:

**Endpoint:** `GET /annual-leave/json`

**Response Format:**

```
{
  "success": true,
  "count": 12,
  "events": [
    {
      "title": "John Doe - Annual Leave",
      "start_timestamp": 1735689600,
      "end_timestamp": 1736294399,
      "start_date": "2025-01-01",
      "end_date": "2025-01-07",
      "start_datetime": "2025-01-01T00:00:00+00:00",
      "end_datetime": "2025-01-07T23:59:59+00:00",
      "readable_start": "01 Jan",
      "readable_end": "07 Jan",
      "readable_range": "01 Jan-07 Jan",
      "timezone": "Europe/London",
      "is_active": true
    }
  ]
}
```

**Error Response:**

```
{
  "error": "GOOGLE_CALENDAR_ICS_URI is not configured"
}
```

**Using the JSON API:**

```
// JavaScript/Fetch example
fetch('/annual-leave/json')
  .then(response => response.json())
  .then(data => {
    console.log(`Found ${data.count} events`);
    data.events.forEach(event => {
      console.log(`${event.title}: ${event.readable_range}`);
    });
  });
```

```
// PHP/Laravel HTTP Client example
$response = Http::get('https://your-app.test/annual-leave/json');
$events = $response->json('events');
```

### Styling

[](#styling)

The widget outputs HTML with the following structure:

```

                01 Jan-05 Jan:
                Event Title

```

You can add your own CSS to style the widget. Events that are currently active (today is between start and end dates) will have the `today` class applied to the `` element.

Configuration Options
---------------------

[](#configuration-options)

The `config/annual_leave.php` file contains the following options:

OptionEnvironment VariableDefaultDescription`google_calendar_ics_uri``GOOGLE_CALENDAR_ICS_URI``null`The URL to your Google Calendar ICS file`timezone``ANNUAL_LEAVE_TIMEZONE``Europe/London`Default timezone for parsing events`max_events``ANNUAL_LEAVE_MAX_EVENTS``12`Maximum number of upcoming events to display`enable_routes``ANNUAL_LEAVE_ENABLE_ROUTES``true`Whether to automatically register routes`route_prefix``ANNUAL_LEAVE_ROUTE_PREFIX``annual-leave`URL prefix for package routes`route_middleware`N/A`[]`Middleware to apply to routes (set in config file)License
-------

[](#license)

This package is open-sourced software. Please check the repository for license information.

Credits
-------

[](#credits)

- [Fred Bradley](https://github.com/fredbradley)
- [Cranleigh School](https://github.com/cranleighschool)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance94

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Total

2

Last Release

25d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1639226?v=4)[Fred Bradley](/maintainers/fredbradley)[@fredbradley](https://github.com/fredbradley)

---

Top Contributors

[![fredbradley](https://avatars.githubusercontent.com/u/1639226?v=4)](https://github.com/fredbradley "fredbradley (11 commits)")

---

Tags

laravelicscalendarwidgetgoogle calendarleave-managementannual-leave

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fredbradley-annual-leave-widget/health.svg)

```
[![Health](https://phpackages.com/badges/fredbradley-annual-leave-widget/health.svg)](https://phpackages.com/packages/fredbradley-annual-leave-widget)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k28.4M134](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M120](/packages/laravel-pulse)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8455.5M96](/packages/laravel-doctrine-orm)[moonshine/moonshine

Laravel administration panel

1.3k239.9k72](/packages/moonshine-moonshine)[hasinhayder/tyro-dashboard

Tyro Dashboard - Beautiful admin dashboard for managing Tyro roles, privileges, users, and settings

5222.7k](/packages/hasinhayder-tyro-dashboard)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
