PHPackages                             clue/viewvc-api-react - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. clue/viewvc-api-react

ActiveLibrary[Queues &amp; Workers](/categories/queues)

clue/viewvc-api-react
=====================

Simple, async access to ViewVC web interface (Subversion/CVS browser)

v0.4.0(10y ago)3203[1 issues](https://github.com/clue/php-viewvc-api-react/issues)MITPHPPHP &gt;=5.3

Since Apr 7Pushed 10y ago3 watchersCompare

[ Source](https://github.com/clue/php-viewvc-api-react)[ Packagist](https://packagist.org/packages/clue/viewvc-api-react)[ Docs](https://github.com/clue/php-viewvc-api-react)[ RSS](/packages/clue-viewvc-api-react/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (5)Dependencies (7)Versions (6)Used By (0)

clue/viewvc-api-react [![Build Status](https://camo.githubusercontent.com/eb79b42867431bd946ad09f32486ce254e614cb15697edc3ac24087593c0b1fd/68747470733a2f2f7472617669732d63692e6f72672f636c75652f7068702d7669657776632d6170692d72656163742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/clue/php-viewvc-api-react)
================================================================================================================================================================================================================================================================================================================================

[](#clueviewvc-api-react-)

Simple, async API-like access to your [ViewVC](http://viewvc.org/) web interface (Subversion/CVS browser), built on top of [React PHP](http://reactphp.org/).

**Table of Contents**

- [Quickstart example](#quickstart-example)
- [Usage](#usage)
    - [Client](#client)
        - [Actions](#actions)
        - [Promises](#promises)
        - [Blocking](#blocking)
        - [Streaming](#streaming)
- [Install](#install)
- [License](#license)

Quickstart example
------------------

[](#quickstart-example)

Once [installed](#install), you can use the following code to fetch a directory listing from the given ViewVC URL:

```
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$client = new Client($browser->withBase('http://example.com/viewvc/'));

$client->fetchDirectory('/')->then(function ($files) {
    echo 'Files: ' . implode(', ', $files) . PHP_EOL;
});

$loop->run();
```

See also the [examples](examples).

Usage
-----

[](#usage)

### Client

[](#client)

The `Client` is responsible for assembling and sending HTTP requests to the remote ViewVC web interface. It requires a [`Browser`](https://github.com/clue/php-buzz-react#browser) object bound to the main [`EventLoop`](https://github.com/reactphp/event-loop#usage)in order to handle async requests:

```
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);

$client = new Client($browser->withBase('http://example.com/viewvc/'));
```

The `Client` API uses relative URIs to reference files and directories in your ViewVC installation, so make sure to apply the base URI as depicted above.

If you need custom DNS or proxy settings, you can explicitly pass a custom [`Browser`](https://github.com/clue/php-buzz-react#browser) instance.

#### Actions

[](#actions)

ViewVC does not officially expose an API. However, its REST-like URLs make it easy to construct the right requests and scrape the results from its HTML output. All public methods resemble these respective actions otherwise available in the ViewVC web interface.

```
$client->fetchDirectory($path, $revision = null);
$client->fetchFile($path, $revision = null);
$client->fetchPatch($path, $r1, $r2);
$client->fetchLog($path, $revision = null);

// many more…
```

All actions support async operation by returning [promises](#promises).

Listing all available actions is out of scope here, please refer to the [class outline](src/Client.php).

#### Promises

[](#promises)

Sending requests is async (non-blocking), so you can actually send multiple requests in parallel. ViewVC will respond to each request with a response message, the order is not guaranteed. Sending requests uses a [Promise](https://github.com/reactphp/promise)-based interface that makes it easy to react to when a request is fulfilled (i.e. either successfully resolved or rejected with an error).

```
$client->fetchFile($path)->then(
    function ($contents) {
        // file contents received
    },
    function (Exception $e) {
        // an error occured while executing the request
    }
});
```

If this looks strange to you, you can also use the more traditional [blocking API](#blocking).

#### Blocking

[](#blocking)

As stated above, this library provides you a powerful, async API by default.

If, however, you want to integrate this into your traditional, blocking environment, you should look into also using [clue/block-react](https://github.com/clue/php-block-react).

The resulting blocking code could look something like this:

```
use Clue\React\Block;

$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);

$client = new Client($browser->withBase($uri /* change me */));
$promise = $client->fetchFile($path /* change me */);

try {
    $contents = Block\await($promise, $loop);
    // file contents received
} catch (Exception $e) {
    // an error occured while executing the request
}
```

Refer to [clue/block-react](https://github.com/clue/php-block-react#readme) for more details.

#### Streaming

[](#streaming)

The following API endpoint resolves with the file contents as a string:

```
$client->fetchFile($path);
```

Keep in mind that this means the whole string has to be kept in memory. This is easy to get started and works reasonably well for smaller files.

For bigger files it's usually a better idea to use a streaming approach, where only small chunks have to be kept in memory. This works for (any number of) files of arbitrary sizes.

The following API endpoint complements the default Promise-based API and returns an instance implementing `ReadableStreamInterface` instead:

```
$stream = $client->fetchFileStream($path);

$stream->on('data', function ($chunk) {
    echo $chunk;
});

$stream->on('error', function (Exception $error) {
    echo 'Error: ' . $error->getMessage() . PHP_EOL;
});

$stream->on('close', function () {
    echo '[DONE]' . PHP_EOL;
});
```

Install
-------

[](#install)

The recommended way to install this library is [through Composer](http://getcomposer.org). [New to Composer?](http://getcomposer.org/doc/00-intro.md)

This will install the latest supported version:

```
$ composer require clue/viewvc-api-react:^0.4
```

See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

License
-------

[](#license)

MIT

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~93 days

Total

5

Last Release

3706d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/776829?v=4)[Christian Lück](/maintainers/clue)[@clue](https://github.com/clue)

---

Top Contributors

[![clue](https://avatars.githubusercontent.com/u/776829?v=4)](https://github.com/clue "clue (56 commits)")

---

Tags

asyncreactphpsubversioncvsViewVC

### Embed Badge

![Health badge](/badges/clue-viewvc-api-react/health.svg)

```
[![Health](https://phpackages.com/badges/clue-viewvc-api-react/health.svg)](https://phpackages.com/packages/clue-viewvc-api-react)
```

###  Alternatives

[react/socket

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP

1.3k129.1M438](/packages/react-socket)[react/dns

Async DNS resolver for ReactPHP

536126.3M102](/packages/react-dns)[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.5M29](/packages/league-geotools)[clue/docker-react

Async, event-driven access to the Docker Engine API, built on top of ReactPHP.

112160.9k1](/packages/clue-docker-react)[react/promise-timer

A trivial implementation of timeouts for Promises, built on top of ReactPHP.

34445.7M108](/packages/react-promise-timer)[react/async

Async utilities and fibers for ReactPHP

2229.2M198](/packages/react-async)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
