[OpenID] Fwd: [diso-project] PHP XRDS-Simple Library

chris.messina at gmail.com chris.messina at gmail.com
Sat Dec 27 00:27:52 UTC 2008


Figured folks on these lists would be able to provide some feedback on
Will's initial go at an XRDS-Simple library in PHP:

---------- Forwarded message ----------
From: Will Norris <will at willnorris.com>
Date: Fri, 26 Dec 2008 13:57:23 -0800
Subject: [diso-project] PHP XRDS-Simple Library
To: diso-project at googlegroups.com


I started on a XRDS-Simple library for PHP some time ago and would
like to solicit some feedback.  You can find the current code in the
DiSo repository:

http://diso.googlecode.com/svn/php/xrds-simple/trunk/

My motivation for writing this library is that all of the XRDS code
I've seen thus far has been in the form of fetchers and parsers.  No
one as written an actual generic library for dealing with XRDS as far
as I can tell.  This becomes particularly important when we're needing
to publish an XRDS document and need a clean way for other code (ie.
WordPres plugins) to contribute additional services to be included.
If you've looked at the existing XRDS-Simple plugin for WordPress,
you'll note that the interface for contributing additional services
into the document is less than ideal.  This was okay at the time, but
now we need something better.

The library can be divided into three logical parts (which don't
necessarily translate to separate code just yet):

  - Discovery: getting the XRDS-Simple document for a URI.  Today, we
have three basic methods of doing this (content negotiation, a special
HTTP response header, and a special HTML link tag.  In the future,
this will very possibly (likely) include other methods such as DNS
lookups, known URL locations (/site-meta), and different HTTP response
headers (Link).

  - Marshalling/Unmarshalling: once we know where to get the XRDS
document, we need to parse the XML into something we can work with in
PHP. Similarly, when it comes time to publish an XRDS document, we
need an easy way to convert our PHP structures into well formed XML.
Today, this is not cleanly separated in the code, but I suspect it
will need to be.  This is particularly true if we want to support both
PHP4 and PHP5.  Right now I'm using the PHP DOM library for the
marshalling, which is only available in PHP5.  If we want to support
PHP4, we'll need to write marshallers that use the DOM XML library.
If the code is cleanly abstracted, this won't actually be very
difficult.

  - Working with XRDS: the final logical part of the library has to do
with working with the XRDS itself.  Just the basic methods for adding
and removing the actual elements like Services, Types, URIs, etc, as
well as convenience methods for finding the highest priority URI for
that service that supports a given type.  I've got one or two of these
convenience methods, but haven't thought all the way through how to
expose them.


While this library is currently based on the current XRDS-Simple spec,
I fully expect to migrate it to the new XRD spec that comes out of the
XRI TC.  Right now I'm also only focussing on PHP5.  As I mentioned
above, writing a marshaller for PHP4 shouldn't be too difficult.  I'm
also using a lot of PHP5 conventions for objects that will need to be
modified if we actually think PHP4 support is important enough.  I'm
not ready to make that call either way right now.

Right now I'd love to hear any feedback on this.  There are a couple
of phpUnit tests to see how the pieces fit together.  Does this seem
like a logical approach to this problem?  Am I overlooking anything
really big?

Thanks,
Will

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "DiSo Project" group.
To post to this group, send email to diso-project at googlegroups.com
To unsubscribe from this group, send email to
diso-project+unsubscribe at googlegroups.com
For more options, visit this group at
http://groups.google.com/group/diso-project?hl=en
-~----------~----~----~----~------~----~------~--~---




-- 
Chris Messina
Citizen-Participant &
  Open Web Advocate-at-Large

factoryjoe.com # diso-project.org
citizenagency.com # vidoop.com
This email is:   [ ] bloggable    [X] ask first   [ ] private


More information about the general mailing list