update icalparser to 1e68aae75dbac8f7c27df7b047c0404154d436c4 (supports php 8.2)
This commit is contained in:
parent
d48cf5c579
commit
05f1245d30
27 changed files with 1572 additions and 586 deletions
|
@ -1,44 +1,79 @@
|
|||
# PHP iCal Parser
|
||||
|
||||
[](https://travis-ci.org/OzzyCzech/icalparser) [](https://packagist.org/packages/om/icalparser) [](https://packagist.org/packages/om/icalparser) [](https://packagist.org/packages/om/icalparser) [](https://packagist.org/packages/om/icalparser)
|
||||
[](https://github.com/OzzyCzech/icalparser/actions/workflows/php.yml)
|
||||
[](https://packagist.org/packages/om/icalparser)
|
||||
[](https://packagist.org/packages/om/icalparser)
|
||||
[](https://packagist.org/packages/om/icalparser)
|
||||
[](https://packagist.org/packages/om/icalparser)
|
||||
|
||||
Internet Calendaring Parser [rfc2445](http://www.ietf.org/rfc/rfc2445.txt) or iCal parser is simple PHP 5.6+ class for parsing format into array.
|
||||
Internet Calendaring Parser [rfc2445](https://www.ietf.org/rfc/rfc2445.txt) or iCal parser is simple PHP class for parsing format into array.
|
||||
|
||||
[](https://www.buymeacoffee.com/ozzyczech)
|
||||
|
||||
## How to install
|
||||
|
||||
```bash
|
||||
The recommended way to is via Composer:
|
||||
|
||||
```shell script
|
||||
composer require om/icalparser
|
||||
```
|
||||
|
||||
## Usage
|
||||
## Usage and example
|
||||
|
||||
```php
|
||||
<?php
|
||||
use om\IcalParser;
|
||||
require_once '../vendor/autoload.php';
|
||||
$cal = new \om\IcalParser();
|
||||
|
||||
$cal = new IcalParser();
|
||||
$results = $cal->parseFile(
|
||||
'https://www.google.com/calendar/ical/cs.czech%23holiday%40group.v.calendar.google.com/public/basic.ics'
|
||||
);
|
||||
|
||||
foreach ($cal->getSortedEvents() as $r) {
|
||||
echo sprintf(' <li>%s - %s</li>' . PHP_EOL, $r['DTSTART']->format('j.n.Y'), $r['SUMMARY']);
|
||||
foreach ($cal->getEvents()->sorted() as $event) {
|
||||
printf('%s - %s' . PHP_EOL, $event['DTSTART']->format('j.n.Y'), $event['SUMMARY']);
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Each property of each event is available using the property name (in capital letters) as a key.
|
||||
There are some special cases:
|
||||
|
||||
- multiple attendees with individual parameters: use `ATTENDEES` as key to get all attendees in the following scheme:
|
||||
```php
|
||||
[
|
||||
[
|
||||
'ROLE' => 'REQ-PARTICIPANT',
|
||||
'PARTSTAT' => 'NEEDS-ACTION',
|
||||
'CN' => 'John Doe',
|
||||
'VALUE' => 'mailto:john.doe@example.org'
|
||||
],
|
||||
[
|
||||
'ROLE' => 'REQ-PARTICIPANT',
|
||||
'PARTSTAT' => 'NEEDS-ACTION',
|
||||
'CN' => 'Test Example',
|
||||
'VALUE' => 'mailto:test@example.org'
|
||||
]
|
||||
]
|
||||
```
|
||||
- organizer's name: the *CN* parameter of the organizer property can be retrieved using the key `ORGANIZER-CN`
|
||||
|
||||
You can run example with [PHP Built-in web server](https://www.php.net/manual/en/features.commandline.webserver.php) as follow:
|
||||
|
||||
```shell
|
||||
php -S localhost:8000 -t example
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- PHP 5.6+
|
||||
- PHP 8.0+
|
||||
|
||||
## Run tests
|
||||
|
||||
iCal parser using [Nette Tester](https://github.com/nette/tester).
|
||||
The tests can be invoked via [composer](https://getcomposer.org/).
|
||||
iCal parser using [Nette Tester](https://github.com/nette/tester). The tests can be invoked via [composer](https://getcomposer.org/).
|
||||
|
||||
```bash
|
||||
```shell script
|
||||
composer update
|
||||
composer tests
|
||||
composer test
|
||||
```
|
||||
|
||||
## TODO
|
||||
|
||||
- add ATTENDEE support http://www.kanzaki.com/docs/ical/attendee.html
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue