iCalendar library (critique new use cases for qCal library)

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

iCalendar library (critique new use cases for qCal library)

Postby Luke » Wed Mar 28, 2007 4:51 pm

I've decided to try putting together an open-source php5 library that would allow users to parse and create iCalendar files on the fly. It may not ever see the light of day, but I think it will be a great learning experience. I would just like to get some suggestions as to what to name this library. I was going to go with PHPiCal, but that is kind of already taken... ( http://phpical.org/ )

As far as I know, nothing like this exists. At least not an open-source library... I take that back. I just looked on sourceforge and found bennu. I'll look at it and make an assessment on whether it's good or not. :)

UPDATE- 9/25/07 - I have added a google code homepage for this project here: http://code.google.com/p/qcal/
Last edited by Luke on Tue Sep 25, 2007 7:12 pm, edited 3 times in total.
My Personal Blog :: My Resume
Clever got me this far... then tricky got me in
Luke Visinoni luke d0t visinoni at gmail d0t com
User avatar
Luke
The Ninja Space Mod
 
Posts: 6368
Joined: Fri Aug 05, 2005 1:53 pm
Location: Chico, CA

Postby Maugrim_The_Reaper » Wed Mar 28, 2007 5:08 pm

If you go ahead, be sure to keep the parser well separated. For example, the iCalendar specification (well, RFC at least) is also followed by the hCal microformat so the two can be made interchangeable. I've been fiddling with a hCal parser in bits and pieces so iCal should be a very tidy format to work on.
User avatar
Maugrim_The_Reaper
DevNet Master
 
Posts: 2702
Joined: Tue Nov 02, 2004 6:43 am
Location: Ireland

Postby Luke » Wed Mar 28, 2007 5:19 pm

Here is something I just whipped out just to get an idea of how I want the interface to be... let me know if it's WAY off. Keep in mind it's just a rough idea of how I want it to work and I haven't finished reading the RFC yet. Also, I'm using TDD so the interface will change a lot.

Syntax: [ Download ] [ Hide ]
<?php

// some use cases for PHPiCal



$iCal = new PHPiCal('Luke\'s Test Calendar', 'publish');



$event = new PHPiCal_Event; // uid auto-generated

//$event = new PHPiCal_Event($unique_id); // uid set by user

$event->setTitle('Luke\'s Birthday');

$event->setStartDate(new PHPiCal_Date('2007-04-23'));

$event->setStartTime(new PHPiCal_Time('4:00pm'));

$event->setDescription('Just a nice little birthday get together');

/** and so on **/

$iCal->attach($event);



$todo = new PHPiCal_Todo;

$todo->setTitle('Luke\'s friend\'s birthday');

$todo->setStartDate(new PHPiCal_Date('2007-04-07'));

$todo->setStartTime(new PHPiCal_Time('5:00am'));

/** and so on **/

$iCal->attach($todo);



echo $iCal->render(new PHPiCal_Renderer_Month);



// reading a calendar



$iCal2 = new PHPiCal;



$iCal2->import('./files/test_calendar.ics');

echo $iCal2->render(new PHPiCal_Renderer_hCal);



// exporting to a file



$iCal3 = new PHPiCal('Luke\'s Test Calendar', 'publish');



// add some events, todos, journal entries, etc.



$iCal3->exportFile('./files/test_calendar.ics');

?>
My Personal Blog :: My Resume
Clever got me this far... then tricky got me in
Luke Visinoni luke d0t visinoni at gmail d0t com
User avatar
Luke
The Ninja Space Mod
 
Posts: 6368
Joined: Fri Aug 05, 2005 1:53 pm
Location: Chico, CA

Postby RobertGonzalez » Wed Mar 28, 2007 5:21 pm

That's a lot of code for General Discussion Ninja. :wink:
PHPDN's Most Friendly 2006, Most Helpful, Friendliest 2007, Friendliest, Peacemaker 2008 | Zend Certified Engineer, Zend Framework Certified Engineer
Common Forum Answers | PHPDN Forum Tour | <?php $me = `whoami`; ?> | <?php while (!$succeed) $try++; ?>
I don't offer solutions via PM. I's much more helpful to the community to solve problems in the open so others can benefit from the solution as well.
Help keep our boards online and ad-free.
to support our forums.
User avatar
RobertGonzalez
Site Administrator
 
Posts: 14254
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Postby Luke » Wed Mar 28, 2007 5:38 pm

good point... but in my defense, the original question was "What should I call this" :oops:
My Personal Blog :: My Resume
Clever got me this far... then tricky got me in
Luke Visinoni luke d0t visinoni at gmail d0t com
User avatar
Luke
The Ninja Space Mod
 
Posts: 6368
Joined: Fri Aug 05, 2005 1:53 pm
Location: Chico, CA

Postby RobertGonzalez » Wed Mar 28, 2007 5:52 pm

Maybe you could ask a moderator to move it to PHP - Theory & Design perhaps? ;)
PHPDN's Most Friendly 2006, Most Helpful, Friendliest 2007, Friendliest, Peacemaker 2008 | Zend Certified Engineer, Zend Framework Certified Engineer
Common Forum Answers | PHPDN Forum Tour | <?php $me = `whoami`; ?> | <?php while (!$succeed) $try++; ?>
I don't offer solutions via PM. I's much more helpful to the community to solve problems in the open so others can benefit from the solution as well.
Help keep our boards online and ad-free.
to support our forums.
User avatar
RobertGonzalez
Site Administrator
 
Posts: 14254
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Postby Maugrim_The_Reaper » Thu Mar 29, 2007 3:19 am

Looks fine ;). The Data and Time fields could have an integrated alias, e.g. setDateTime() so it can accept a timestamp or date string. Also be sure to account for the whether the date is local or UTC (or whether it needs conversion even). Only other tricky thing to watch is the format's line endings - CRLF per the RFC (ugh!).
User avatar
Maugrim_The_Reaper
DevNet Master
 
Posts: 2702
Joined: Tue Nov 02, 2004 6:43 am
Location: Ireland

Postby Christopher » Thu Mar 29, 2007 1:06 pm

I am wondering whether the render() and import()/export() methods should be in the main class or moved out to other classes that take a core object in the constructor. I think moving them out would make the system more modular and customizable.

So:
Syntax: [ Download ] [ Hide ]
$month = new PHPiCal_Renderer_Month($iCal);

echo $month ->render();



// reading a calendar



$iCal2 = new PHPiCal;



$io = new PHPiCal_IO($iCal);

$io>import('./files/test_calendar.ics');



$hCal = new PHPiCal_Renderer_hCal($iCal2);

echo $hCal->render();



// exporting to a file



$iCal3 = new PHPiCal('Luke\'s Test Calendar', 'publish');



// add some events, todos, journal entries, etc.



$io->setCal($iCal3);

$io->exportFile('./files/test_calendar.ics');
(#10850)
User avatar
Christopher
Site Administrator
 
Posts: 10514
Joined: Wed Aug 25, 2004 7:54 pm
Location: Portland, Oregon, US

Postby Luke » Thu Mar 29, 2007 1:22 pm

probably will... that is where tdd will come it. It will help me decide on a lot of these ui details. the great thing is... I think I am FINALLY starting to get the hang of this whole testing thing.
My Personal Blog :: My Resume
Clever got me this far... then tricky got me in
Luke Visinoni luke d0t visinoni at gmail d0t com
User avatar
Luke
The Ninja Space Mod
 
Posts: 6368
Joined: Fri Aug 05, 2005 1:53 pm
Location: Chico, CA

Postby Maugrim_The_Reaper » Thu Mar 29, 2007 4:04 pm

Are you contagious yet? ;)
User avatar
Maugrim_The_Reaper
DevNet Master
 
Posts: 2702
Joined: Tue Nov 02, 2004 6:43 am
Location: Ireland

Postby Luke » Fri Mar 30, 2007 12:43 am

:: coughs :: maybe :wink:

Alright, so nobody has any ideas for what to call this thing. I'm at a loss myself. maybe iCalPHP?
My Personal Blog :: My Resume
Clever got me this far... then tricky got me in
Luke Visinoni luke d0t visinoni at gmail d0t com
User avatar
Luke
The Ninja Space Mod
 
Posts: 6368
Joined: Fri Aug 05, 2005 1:53 pm
Location: Chico, CA

Postby Christopher » Fri Mar 30, 2007 1:02 am

I think PHPiCal or iCalPHP are silly because you don't really need to say it's PHP. I would just call the classes Icalendar_* or Ical_*.
(#10850)
User avatar
Christopher
Site Administrator
 
Posts: 10514
Joined: Wed Aug 25, 2004 7:54 pm
Location: Portland, Oregon, US

Postby Luke » Fri Mar 30, 2007 1:12 am

Well the issue with that is iCal is already a known piece of software and iCalendar is a known standard. Let's say somebody on this forum asks "does anybody know where I can find an oop php library that is capable of creating/parsing iCalendar files?". I'd like for the answer to be yea, go do http://www.icalphp.com and download iCalPHP. If I were to name the library simply iCal, that would not be possible.

I really don't like the name iCalPHP nor PHPiCal though. What do you think?

EDIT: What do you think of pical (PHPiCalendar) ?
My Personal Blog :: My Resume
Clever got me this far... then tricky got me in
Luke Visinoni luke d0t visinoni at gmail d0t com
User avatar
Luke
The Ninja Space Mod
 
Posts: 6368
Joined: Fri Aug 05, 2005 1:53 pm
Location: Chico, CA

Postby Christopher » Fri Mar 30, 2007 2:04 am

In that case pical or phical are good ... or how about phpical or icalphp ;)
(#10850)
User avatar
Christopher
Site Administrator
 
Posts: 10514
Joined: Wed Aug 25, 2004 7:54 pm
Location: Portland, Oregon, US

Postby Kieran Huggins » Fri Mar 30, 2007 2:21 am

Php Extension for Normalized iCal Syntax

I happen to know of a computer store with the ideal logo!

Seriously though, maybe you should stick with the incredibly un-sexy "PHPiCal" name, it's far more Google friendly.
User avatar
Kieran Huggins
DevNet Master
 
Posts: 3635
Joined: Wed Dec 06, 2006 5:14 pm
Location: Toronto, Canada

Next

Return to PHP - Theory and Design

Who is online

Users browsing this forum: PCSpectra and 1 guest