Upgrading from SabreDAV 1.7 to 1.8

Only a month after the 1.7 release, 1.8 now follows.

The #1 biggest difference is that we completely moved from the old 'prefix-style' namespacing, to true PHP 5.3 namespaces.

We wanted to get this release quickly out, so we can easily maintain 1.7 and 1.8 side-by-side. They should not diverge much feature-wise.

This document helps explaining the differences, and how to upgrade.

API breaks

We're now using PHP 5.3 namespaces

What does this mean? Simple: wherever you wrote Sabre_DAV_Server before, you now write Sabre\DAV\Server. This applies to every class in the SabreDAV codebase.

Check out the PHP documentation to figure out what benefits this brings.

So for most classnames this is simply a change from _ to \, but there are a few exceptions.

A class named MyPackage_Abstract is a legal class in PHP, but MyPackage\Abstract is not, because the abstract here is a keyword. So a few classes have gotten new names.

Before After
Sabre_DAV_Locks_Backend_Abstract Sabre\DAV\Locks\Backend\Abstractbackend and Sabre\DAV\Locks\Backend\BackendInterface
Sabre_DAV_Auth_IBackend Sabre\DAV\Auth\Backend\BackendInterface
Sabre_CalDAV_Backend_Abstract Sabre\CalDAV\Backend\AbstractBackend
Sabre_CardDAV_Backend_Abstract Sabre\CardDAV\Backend\AbstractBackend and Sabre\CardDAV\Backend\BackendInterface
Sabre_DAVACL_IPrincipalBackend Sabre\DAVACL\PrincipalBackend\BackendInterface

As you can see we also improved consistency. Every 'backend package' now has a BackendInterface as well as an AbstractBackend.

Changed a few constructor signatures

This is only relevant to you if you instantiated one of the following classes directly:

All three of these now have a slightly different constructor signature. They no longer need the PrincipalBackend, and receive more principal information through the constructor.

Make sure you read the updated API documentation and fix this.

Sabre\CalDAV\ISharedCalendar now has a getShares() method

Just like Sabre\CalDAV\IShareableCalendar, the ISharedCalendar now also has a getShares() method.

With this method, it is possible for clients to find out to whom a calendar is shared with (aside from themselves). Returning something is optional, but this method must be implemented.

The other implication is that if you implement Sabre\CalDAV\Backend\SharingSupport, the getShares() method will now also be called by non-owners.