PHP code example of thepublicgood / timewarp

1. Go to this page and download the library: Download thepublicgood/timewarp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thepublicgood / timewarp example snippets


use TPG\Timewarp;

class CalendarController
{
    public function index()
    {
        $calendar = new Timewarp\Calendar();
    }
}

$calendar->addProperty(new Timewarp\Properties\ProdId($productId));

$calendar->addProperty(new Timewarp\Properties\Method($method));

use TPG\Timewarp;

class CalendarController
{
    public function index()
    {
        $event = new Timewarp\Components\Event();
    }
}

$dtStart = new Timewarp\Properties\Start(new \DateTime('2019-01-01 13:30:00'));
$event->addProperty($dtStart)
    ->addProperty(new Timewarp\Properties\Description('New Years! Yeah!');

$calendar->addComponent($event);

$calendar = $event->getCalendar();

$calendar = Timewarp\Calendar::event()->from(2018, 3, 1)->forHours(3);

// UriAttachment represents a URI to a file resource
$attachment = new Timewarp\Properties\UriAttachment('https://example.com/picture.png', 'image/png');

// While BinaryAttachment will base64 encode a file and 

$category = new Timewarp\Properties\Categories(['APPOINTMENTS', 'EDUCATION']);

$class = new Timewarp\Properties\Classification(Timewarp\Properties\Classification::PRIVATE);

// or...
$class = new Timewarp\Properties\Classification('PUBLIC');

$comment = new Timewarp\Properties\Comment('Add a comment to a calendar object');

$start = new Timewarp\Properties\Start(new \DateTime('2019-01-01 13:30:00'));

// Libraries like Carbon extend DateTime, so you can also do:
$start = new Timewarp\Properties\Start(Carbon::create(2019, 1, 1));

$end = new Timewarp\Properties\End(new \DateTime('2019-01-01 19:30:00'));