Giter Club home page Giter Club logo

ics-generator's Introduction

ICS File Generator

This is a from of (https://github.com/hising/ics-generator), who is a fork of of (https://github.com/ahmad/ics.generator). LICENSE is taken from that repo.

This class generates an ICS file that users can download and add to their Calender. It is compatible with any software that supports standard ICS files which includes Outlook, Google Calander, iCal and many more.

Version 0.2 Released: 04/16/2012

Usage

The library was designed to be simple and get to you up and running in the shortest amount of time.

Step 1: Getting the library

I would recommend you download the library directly from my git repository (https://github.com/hising/ics-generator) because it will always be up-to-date with the latest release. All you need is to have Composer installed and include the class Invite that does all the magic.

    $ git clone https://github.com/hising/ics-generator.git
    $ cd ics-generator
    $ curl -sS https://getcomposer.org/installer | php
    $ php composer.phar install

Step 2: Usage

Edit the settings.php file and set the correct timezone for your needs.

As mentioned above this class was designed to be as simple as possible to use. All that is required is for you to be a little familiar with Object-Oriented PHP or just understand code at least. If you are not familiar with OO PHP that is not a problem because you can just copy and paste this example below into you project and modify the details to suite your needs.

I would highly recommend you do not alter or modify the invite.php file or class. You should do all your programming and customization in a separate file.

// alter path based on where in your file structure the invite.php file is located
require "settings.php";

use IcsGenerator\Invite;

$invite = new Invite($unique_id); // You should (not required) provide a UNIQUE ID

// As you may notice this library supports chaining which may be a little weird for many PHP programmer
$invite 
	    ->setSubject("Test Demo Invite")
	    ->setDescription("The is a test invite for you to see how this thing actually works") 
	    ->setStart(new DateTime('2013-03-16 12:00AM EST'))
	    ->setEnd(new DateTime('2013-03-16 11:59PM EST'))
	    ->setLocation("Queens, New York")
	    ->setOrganizer("[email protected]", "John Doe")
	    ->addAttendee("[email protected]", "Ahmad Amin");

$invite -> download();

If you do now want to use the chaining method as listed about you can use it as such:

require "settings.php";

use IcsGenerator\Invite;

$invite = new Invite($unique_id);

$invite ->setSubject("Test Demo Invite");
$invite ->setDescription("The is a test invite for you to see how this thing actually works");
$invite ->setStart(new DateTime('2013-03-16 12:00AM EST'));
$invite ->setEnd(new DateTime('2013-03-16 11:59PM EST'));
$invite ->setLocation("Queens, New York");
$invite ->setOrganizer("[email protected]", "John Doe");
$invite ->addAttendee("[email protected]", "Ahmad Amin");

$invite -> download();

The generated output file is invite.ics. You can open that file with Outlook or iCal.

Step 3: Check if downloaded (optional)

If you would like to check and see if the invite has been downloaded or not you can use Invite::isDownloaded() method as listed below.

if(Invite::isDownloaded()){
    // do something ...
}

As you may notice the isDownloaded() method is a static method so you do not need to create a new Invite() object to call it. At anytime you can use it to check and see if the invite has been downloaded.

Step 4: Advance Usage

Please look at example/example2.php for a more advance usage method which allows you to generate and save the file to be downloaded at a later time.

Step 5: Lead More

I would highly recommend you take a look at the invite.php file for other methods and alias of these methods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.