PECL SVN Package

This package allows a PHP script to communicate with a Subversion repository using PHP function calls. No hacks using the svn command line interface. I was unable to find documentation so I dug through the PECL code and tried my best, here you go.

Constants and Function List

This package defines the following constants and imports them into the namespace of the script.

This package defines the following functions and imports them into the namespace of the script.

Usage

Setup a connection before running any other calls.

dl('svn.so'); // Load SVN module (or set in php.ini)

$url = 'http://svn.domain.com/svn/';
$rev = -1; // -1 == HEAD

svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME,'dude');
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD,'d00d');

Get a list of files/directories at a given Subversion url, specify a revision to view a listing at that point in time.

$ls = svn_ls($url,$rev);

$ls is now and array of entry arrays, as below.

Array
(
    [0] => Array
        (
            [created_rev] => 395
            [last_author] => dbusby
            [size] => 0
            [time] => Jan 18 07:43
            [time_t] => 1137598980
            [name] => branches
            [type] => dir
        )

    [1] => Array
        (
            [created_rev] => 400
            [last_author] => dbusby
            [size] => 0
            [time] => Jan 18 11:30
            [time_t] => 1137612626
            [name] => trunk
            [type] => dir
        )
)

View some logs entries.

See Also

ChangeLog