Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 27 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,43 @@ Symfony Bundle providing dependency injection for the Jsvrcek\ICS library, which

## Installation

composer req jsvrcek/ics-bundle
`composer req jsvrcek/ics-bundle`


## Usage

```php
namespace App\Services;
namespace App\Services;

class MyService
{
private Formatter $formatter;
private CalendarExport $calendarExport;

class MyService
{


public function __construct(Formatter $formatter, CalendarExport $calendarExport) {

$this->formatter = $formatter;
$this->calendarExport = $calendarExport;
}
}
```


// or inject them into the controller
Or inject them into the controller
```php

public function calendarAction(Formatter $formatter, CalendarExport $calendarExport)
{
$eventOne = new CalendarEvent();
$eventOne->setStart(new \DateTime())
->setSummary('Family reunion')
->setUid('event-uid');

//add an Attendee
$attendee = new Attendee($this->formatter); // or $formatter
$attendee->setValue('moe@example.com')
->setName('Moe Smith');
$eventOne->addAttendee($attendee);


$response = new Response($calendarExport->getStream());
$response->headers->set('Content-Type', 'text/calendar');

return $response;
}
}
public function calendarAction(Formatter $formatter, CalendarExport $calendarExport)
{
$eventOne = new CalendarEvent();
$eventOne->setStart(new \DateTime())
->setSummary('Family reunion')
->setUid('event-uid');

//add an Attendee
$attendee = new Attendee($this->formatter); // or $formatter
$attendee->setValue('moe@example.com')
->setName('Moe Smith');
$eventOne->addAttendee($attendee);

$response = new Response($calendarExport->getStream());
$response->headers->set('Content-Type', 'text/calendar');

return $response;
}
```