Skip to content

linktoahref/vevent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Simple VEvent Generator

Installation

composer require linktoahref/vevent

Usage

use LTAH\Generator\VEvent;

$event = VEvent::create('Event Summary or Title', new DateTime('2018-05-10'), new DateTime('2018-05-11'));

$event->addOrganizer('Organizer Name', 'test@mail.com');

$event->addAttendees('Attendee Name', 'foo@bar.com');

echo $event->render();

Send the Event in Mail

If using Laravel you could modify the Mailable class's withSwiftMessage method within the build method

$this->markdown('emails.mailable')
        ->with([ params ]);

$this->withSwiftMessage(function ($message) use ($ical, $subject) {
    $message->setBody($event->render(), 'text/calendar; charset="utf-8"; method=REQUEST');
    $message->addPart($this->buildView()['html']->toHtml(), 'text/html');
});

return 
    $this->subject($subject)
        ->attachData($event->render(), 'meeting.ics', [
            'mime' => 'text/calendar; charset="utf-8"; method=REQUEST',
        ]);

This would render the event with styling in gmail and outlook

About

A Simple VEvent Generator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages