Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Calendar Links

Calendar Links Laravel Package

spatie/calendar-links

Generate “Add to calendar” links and ICS files for events. Supports Google Calendar, iCal/Apple Calendar, Outlook and more. Define title, start/end, description and location, then get shareable URLs or downloadable .ics content for your app.

View on GitHub
Deep Wiki
Context7

Generate add to calendar links for Google, iCal and other calendar systems

Frequently asked questions about Calendar Links
How do I generate a Google Calendar link for an event in Laravel?
Use `Link::create()` with event details (title, start/end times) and chain `->google()`. Example: `Link::create('Event', $startDate, $endDate)->google()`. This returns a shareable URL users can click to add the event to Google Calendar.
Does this package work with Laravel’s Carbon for dates?
Yes, the package accepts `DateTime` or `Carbon` instances interchangeably. Just pass your Carbon objects directly to `Link::create()`. Internally, it uses `DateTimeImmutable` for consistency and thread safety.
Can I generate ICS files for Outlook or Apple Calendar?
Absolutely. Use `Link::create()->ics()` to generate a downloadable `.ics` file. The package adheres to RFC 5545, so the output works in Outlook, Apple Calendar, and other iCal-compatible systems. Attach the file to emails or serve it via Laravel responses.
What Laravel versions does this package support?
The package has no Laravel-specific dependencies and works with any Laravel 8.x+ or 9.x+ app. It requires PHP 8.3+ (for v2+). Tested thoroughly with Laravel’s latest stable releases, including its DateTime utilities like Carbon.
How do I customize the calendar link for a niche system (e.g., Salesforce Calendar)?
Extend the package by creating a custom generator. Implement the `CalendarLinkGenerator` interface and pass it to `Link::create()->formatWith($yourGenerator)`. The README provides a full example. This avoids forking and keeps your changes maintainable.
Will this work in a Laravel API for dynamic event creation?
Yes, it’s API-friendly. Generate links on-demand in controllers or queue jobs. Return the URLs in JSON responses (e.g., `['google_link' => $link->google()]`). For bulk events, pre-generate ICS files and store them in storage or a database.
Are there performance concerns with generating ICS files for large events (e.g., conferences)?
ICS generation is lightweight, but large events (e.g., multi-day conferences) may produce sizable files. Benchmark your use case. For APIs, cache generated ICS files in Laravel’s filesystem or use `spatie/laravel-medialibrary` for optimized storage.
How do I test calendar links in my Laravel app?
Test Google/Outlook links by verifying the generated URLs match expected formats (e.g., `https://calendar.google.com/...`). For ICS files, validate against RFC 5545 using tools like `icalendar.org/validator`. Mock timezone handling in tests to cover edge cases like all-day events.
Can I use this package in a non-web context (e.g., Laravel queues or CLI tools)?
Yes, the package is framework-agnostic. Use it in queue jobs (e.g., send calendar invites via `Mail::send()` with ICS attachments) or CLI scripts. No Blade or HTTP dependencies are required—just pass event data to `Link::create()`.
What’s the migration path if I’m using v1.x and want to upgrade to v2+?
v2+ introduces `DateTimeImmutable` and fixes all-day event logic. Update your code to use `Link::create()` with immutable dates. Run `composer update spatie/calendar-links` and test edge cases like timezone handling. The changelog details breaking changes.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony