update icalparser to 1e68aae75dbac8f7c27df7b047c0404154d436c4 (supports php 8.2)

This commit is contained in:
root 2023-07-16 02:51:26 +02:00
parent d48cf5c579
commit 05f1245d30
27 changed files with 1572 additions and 586 deletions

View file

@ -1,44 +1,79 @@
# PHP iCal Parser
[![Build Status](https://travis-ci.org/OzzyCzech/icalparser.svg?branch=master)](https://travis-ci.org/OzzyCzech/icalparser) [![Latest Stable Version](https://poser.pugx.org/om/icalparser/v/stable.png)](https://packagist.org/packages/om/icalparser) [![Total Downloads](https://poser.pugx.org/om/icalparser/downloads.png)](https://packagist.org/packages/om/icalparser) [![Latest Unstable Version](https://poser.pugx.org/om/icalparser/v/unstable.png)](https://packagist.org/packages/om/icalparser) [![License](https://poser.pugx.org/om/icalparser/license.png)](https://packagist.org/packages/om/icalparser)
[![PHP Tests](https://github.com/OzzyCzech/icalparser/actions/workflows/php.yml/badge.svg)](https://github.com/OzzyCzech/icalparser/actions/workflows/php.yml)
[![Latest Stable Version](https://poser.pugx.org/om/icalparser/v/stable)](https://packagist.org/packages/om/icalparser)
[![Total Downloads](https://poser.pugx.org/om/icalparser/downloads)](https://packagist.org/packages/om/icalparser)
[![License](https://poser.pugx.org/om/icalparser/license)](https://packagist.org/packages/om/icalparser)
[![PHP Version Require](http://poser.pugx.org/om/icalparser/require/php)](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.
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](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