PHP code example of wp-php-toolkit / svn

1. Go to this page and download the library: Download wp-php-toolkit/svn 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/ */

    

wp-php-toolkit / svn example snippets



WordPress\Svn\SvnClient;

$client = new SvnClient();
$result = $client->checkout(
	'https://plugins.svn.wordpress.org/hello-dolly/trunk',
	'/tmp/hello-dolly'
);

echo "checked out r{$result['revision']}\n";
echo file_get_contents( '/tmp/hello-dolly/hello.php' );


WordPress\Svn\SvnClient;

$client = new SvnClient( array(
	'username' => 'my-wporg-login',
	'password' => getenv( 'SVN_PASSWORD' ),
) );

$wc = '/tmp/my-plugin';
$client->checkout( 'https://plugins.svn.wordpress.org/my-plugin/trunk', $wc );

file_put_contents( "$wc/readme.txt", "= My Plugin 1.1 =\n" );
file_put_contents( "$wc/new-feature.php", " // ...\n" );
$client->add( $wc, 'new-feature.php' );
$client->delete( $wc, 'deprecated.php' );

print_r( $client->status( $wc ) );

$info = $client->commit( $wc, 'Release 1.1.' );
echo "committed r{$info['revision']}\n";


WordPress\Svn\SvnClient;

$client  = new SvnClient();
$session = $client->open_session( 'https://develop.svn.wordpress.org/trunk' );

echo "HEAD is r{$session->get_latest_revision()}\n";
foreach ( $session->list_directory( 'src/wp-