{"id":22640759,"url":"https://github.com/beastbytes/icalendar","last_synced_at":"2025-03-29T05:26:16.545Z","repository":{"id":65691622,"uuid":"596664548","full_name":"beastbytes/icalendar","owner":"beastbytes","description":"Create, edit, and import iCalendar files","archived":false,"fork":false,"pushed_at":"2023-06-26T13:47:49.000Z","size":123,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-03T15:55:03.084Z","etag":null,"topics":["icalendar","php","rfc5545","rfc7986"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beastbytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-02T17:14:13.000Z","updated_at":"2023-02-12T22:52:33.000Z","dependencies_parsed_at":"2025-02-03T15:51:23.797Z","dependency_job_id":"c5af3ac5-5185-46fe-8259-2a76c1de4e95","html_url":"https://github.com/beastbytes/icalendar","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Ficalendar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Ficalendar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Ficalendar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Ficalendar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beastbytes","download_url":"https://codeload.github.com/beastbytes/icalendar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246143364,"owners_count":20730248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["icalendar","php","rfc5545","rfc7986"],"created_at":"2024-12-09T04:13:47.837Z","updated_at":"2025-03-29T05:26:16.540Z","avatar_url":"https://github.com/beastbytes.png","language":"PHP","readme":"# iCalendar\nThe iCalendar library provides the ability to create, edit, and import [RFC 5545 - Internet Calendaring and Scheduling (iCalendar)](https://datatracker.ietf.org/doc/html/rfc5545)\nincluding properties defined in [RFC 7986 - New Properties for iCalendar](https://datatracker.ietf.org/doc/html/rfc7986).\n\n## Creating iCalendars\nThe iCalendar library allows creation of iCalendars in an object-oriented way.\n\nTo create an iCalendar, create a new Vcalendar object then add properties and components to it; properties and other components are added to child components in a similar way; multiple components of the same type are supported, as are multiple properties with the same name in a component.\n\nFinally, call the Vcalendar's render() method.\n\nAll iCalendar components are immutable.\n\n### UIDs\nVEVENT, VFREEBUSY, VJOURNAL, and VTODO components require the UID property;since RFC 7985 it can also be set in VCALENDAR. RFC 7985 udates the recommendation on how to construct the value; it deprecates the use of IP addresses and host and domain names due particularly due privacy and security concerns, and recommends use of Universally Unique Identifier (UUID) values as defined in Sections [4.4](https://datatracker.ietf.org/doc/html/rfc4122#section-4.4) and [4.5](https://datatracker.ietf.org/doc/html/rfc4122#section-4.5) of [RFC4122](https://datatracker.ietf.org/doc/html/rfc4122). \n\nThe library provides a helper method that generates V4 UUIDs.\n\n```php\n$vCalendar = (new Vcalendar())\n    -\u003eaddProperty(Vcalendar::PROPERTY_UID, Vcalendar::uuidv4())\n    -\u003eaddComponent((new Vevent())\n        -\u003eaddProperty(Vevent::PROPERTY_UID, Vevent::uuidv4())\n    )\n;\n```\n\n### Non-standard Components\nIANA and X- components can be added to the iCalender object (Vcalendar).\n\nNon-standard components must extend Component and define the NAME constant; they must be registered in Vcalendar before use.\n\n```php\nuse BeastBytes\\ICalendar\\Component;\n\nclass NonStandardComponent extends Component\n{\n    public const NAME = 'NON-STANDARD-COMPONENT';\n\n    protected const CARDINALITY = [\n        // declare cardinality of the component's properties here\n    ];\n}\n---\nVcalendar::registerNonStandardComponent(NonStandardComponent::NAME);\n\n$nonStandardComponent = new NonStandardComponent();\n\n$vCalendar = (new Vcalendar())-\u003eaddComponent($nonStandardComponent);\n// $vCalendar-\u003ehasComponent(NonStandardComponent::NAME) === true;\n```\n\n### Non-standard Properties\nIANA and X- properties can be added to iCalender components.\n\nNon-standard properties must be registered with the component before use; the default cardinality is one or many may be present.\n\n```php\npublic const NON_STANDARD_PROPERTY = 'NON-STANDARD-PROPERTY';\n\nVevent::registerNonStandardProperty(self::NON_STANDARD_PROPERTY, Vevent::CARDINALITY_ONE_MAY);\n\n$vEvent = (new Vevent())-\u003eaddProperty(self::NON_STANDARD_PROPERTY, $value);\n// $vEvent-\u003ehasProperty(self::NON_STANDARD_PROPERTY) === true;\n```\n\n### Example\nThe following example creates a To-Do with an alarm (it is the example on page 146 of RFC5545 modified to use UUID V4 for UID).\n\n```php\n$iCalendar = (new Vcalendar())\n    -\u003eaddProperty(Vcalendar::PROPERTY_PRODUCT_IDENTIFIER, '-//ABC Corporation//NONSGML My Product//EN')\n    -\u003eaddComponent((new Vtodo())\n        -\u003eaddProperty(Vtodo::PROPERTY_DATETIME_STAMP, '19980130T134500Z')\n        -\u003eaddProperty(Vtodo::PROPERTY_SEQUENCE, 2)\n        -\u003eaddProperty(Vtodo::PROPERTY_UID, Vtodo::uuidv4())\n        -\u003eaddProperty(Vtodo::PROPERTY_ORGANIZER, 'mailto:unclesam@example.com')\n        -\u003eaddProperty(\n            Vtodo::PROPERTY_ATTENDEE,\n            'mailto:jqpublic@example.com',\n            [\n                Vtodo::PARAMETER_PARTICIPATION_STATUS =\u003e Vtodo::STATUS_ACCEPTED\n            ]\n        )\n        -\u003eaddProperty(Vtodo::PROPERTY_DATETIME_DUE, '19980415T000000')\n        -\u003eaddProperty(Vtodo::PROPERTY_STATUS, Vtodo::STATUS_NEEDS_ACTION)\n        -\u003eaddProperty(Vtodo::PROPERTY_SUMMARY, 'Submit Income Taxes')\n        -\u003eaddComponent((new Valarm())\n            -\u003eaddProperty(Valarm::PROPERTY_ACTION, Valarm::ACTION_AUDIO)\n            -\u003eaddProperty(Valarm::PROPERTY_TRIGGER, '19980403T120000Z')\n            -\u003eaddProperty(\n                Valarm::PROPERTY_ATTACH,\n                'http://example.com/pub/audio-files/ssbanner.aud',\n                [\n                    Valarm::PARAMETER_FORMAT_TYPE =\u003e 'audio/basic'\n                ]\n            )\n            -\u003eaddProperty(Valarm::PROPERTY_REPEAT, 4)\n            -\u003eaddProperty(Valarm::PROPERTY_DURATION, 'PT1H')\n        )\n    )\n    -\u003erender()\n;\n```\n\nSee tests for more examples.\n\n## Edit iCalendar\niCalendar components can be edited, for example when updating a Vevent.\n\nThe library has methods for editing components:\n\n* hasComponent($name) - whether a component has one or more components of type $name\n* getComponents() - returns all child components\n* getComponent($name) - returns all child components of type $name\n* getComponent($name, $n) - returns the $nth occurrence of the child component of type $name\n* setComponent($component, $n) - set (overwrite) the $nth occurrence of the type of $component with $component\n* removeComponent($name) - remove all child components of type $name\n* removeComponent($name, $n) - remove the $nth occurrence of the child component of type $name\n\n* hasProperty($name) - whether a component has one or more properties of type $name\n* getProperties() - returns all component properties\n* getProperty($name) - returns all component properties of type $name\n* getProperty($name, $n) - returns the $nth occurrence of the component property of type $name\n* setProperty($name, $n, $value, $parameters) - set (overwrite) the $nth occurrence of the property of type $name with new $value and $parameters\n* removeProperty($name) - remove all component properties of type $name\n* removeProperty($name, $n) - remove the $nth occurrence of the component property of type $name\n\n## Import iCalendar\nImport an iCalendar string using Vcalendar::import():\n\n```php\n$icalendar = Vcalendar::import($string);\n```\n\n## Installation\nThe preferred way to install the library is with [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require --prefer-dist beastbytes/icalendar\n```\n\nor add\n\n```json\n\"beastbytes/icalendar\": \"*\"\n```\n\nto the 'require' section of your composer.json.\n\n## Testing\n### Unit testing\nThe package is tested with PHPUnit. To run the tests:\n\n```\n./vendor/bin/phpunit\n```\n\n### Static analysis\nThe code is statically analyzed with Psalm. To run static analysis:\n\n```\n./vendor/bin/psalm\n```\n\n## License\nThe iCalendar Library is free software. It is released under the terms of the BSD License. For license information see the [LICENSE](LICENSE.md) file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeastbytes%2Ficalendar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeastbytes%2Ficalendar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeastbytes%2Ficalendar/lists"}