PHPackages                             rcs\_us/php-git-server - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. rcs\_us/php-git-server

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

rcs\_us/php-git-server
======================

DAV based PHP based Git server. No dependencies on git command.

1.0.1(8y ago)116MITPHPPHP ^5.5 || ^7.0

Since Jan 17Pushed 8y ago1 watchersCompare

[ Source](https://github.com/conrad10781/php-git-server)[ Packagist](https://packagist.org/packages/rcs_us/php-git-server)[ RSS](/packages/rcs-us-php-git-server/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

php-git-server
==============

[](#php-git-server)

DAV based PHP based Git server. No dependencies on git command.

Install
-------

[](#install)

Install latest version using [composer](https://getcomposer.org/).

```
$ composer require rcs_us/php-git-server

```

Usage
-----

[](#usage)

The server extends sabre.io's DAV server() and nikic's FastRoute ().

A basic implementation would look like the following:

```
if (PHP_SAPI == "cli-server") {
    // To help the built-in PHP dev server, check if the request was actually for
    // something which should probably be served as a static file
    $file = __DIR__ . $_SERVER['REQUEST_URI'];
    if (is_file($file)) {
        return false;
    }
}

// Define source path ( built in PHP server doesn't like relative paths )
defined('SOURCE_PATH')
|| define('SOURCE_PATH', (getenv('SOURCE_PATH') ? getenv('SOURCE_PATH') : dirname(__DIR__)));

defined('REPOSITORY_PATH')
|| define('REPOSITORY_PATH', (getenv('REPOSITORY_PATH') ? getenv('REPOSITORY_PATH') : "/tmp/git-repositories"));

$loader = require SOURCE_PATH . "/vendor/autoload.php";

$rcsGitServer = new \RCS\Git\Server();

$serverAuthBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function($user, $pass){
    $args = [$user, $pass];
    error_log("args: " . print_r($args, true) );
    return true;
});

$serverAuthPlugin  = new \Sabre\DAV\Auth\Plugin($serverAuthBackend);

// OPTIONALLY, you can add authentication this way
// $rcsGitServer->addServerPlugin($serverAuthPlugin);

$dispatcher = \FastRoute\simpleDispatcher(function(\FastRoute\RouteCollector $r) {

    // This can also be a single addRoute(['PROPFIND','MKCOL',....])
    $r->addRoute('PROPFIND', '/{repository}.git/[{path:.+}]', 'webdav');
    $r->addRoute('MKCOL', '/{repository}.git/[{path:.+}]', 'webdav');
    $r->addRoute('LOCK', '/{repository}.git/[{path:.+}]', 'webdav');
    $r->addRoute('PUT', '/{repository}.git/[{path:.+}]', 'webdav');
    $r->addRoute('UNLOCK', '/{repository}.git/[{path:.+}]', 'webdav');
    $r->addRoute('GET', '/{repository}.git/[{path:.+}]', 'webdav');
    $r->addRoute('MOVE', '/{repository}.git/[{path:.+}]', 'webdav');

});

// Fetch method and URI from somewhere
$httpMethod = $_SERVER['REQUEST_METHOD'];
$uri = $_SERVER['REQUEST_URI'];

// Strip query string (?foo=bar) and decode URI
if (false !== $pos = strpos($uri, '?')) {
    $uri = substr($uri, 0, $pos);
}
$uri = rawurldecode($uri);

$routeInfo = $dispatcher->dispatch($httpMethod, $uri);
switch ($routeInfo[0]) {
    case \FastRoute\Dispatcher::NOT_FOUND:
        error_log("\FastRoute\Dispatcher::NOT_FOUND");
        // ... 404 Not Found
        break;
    case \FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
        error_log("\FastRoute\Dispatcher::METHOD_NOT_ALLOWED");
        $allowedMethods = $routeInfo[1];
        // ... 405 Method Not Allowed
        break;
    case \FastRoute\Dispatcher::FOUND:
        error_log("\FastRoute\Dispatcher::FOUND");
        $handler = $routeInfo[1];
        $vars = $routeInfo[2];
        // ... call $handler with $vars

        // list($class, $method) = explode(":", $handler, 2);
        // call_user_func_array(array(new $class, $method), $vars);
        call_user_func(array($rcsGitServer, $handler), $vars);

        break;
}

// So you can see the requests as they come in on the PHP built in server
if (PHP_SAPI == "cli-server") {
    error_log($_SERVER["REQUEST_METHOD"] . "::" . $_SERVER["REQUEST_URI"]."\n");
}
```

This can be tested with PHP's built in server using ( you can substitute 8888 for whatever port you want ):

```
php -S localhost:8888 -t public index.php
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3087d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/238705?v=4)[conrad10781](/maintainers/conrad10781)[@conrad10781](https://github.com/conrad10781)

---

Top Contributors

[![conrad10781](https://avatars.githubusercontent.com/u/238705?v=4)](https://github.com/conrad10781 "conrad10781 (7 commits)")

---

Tags

phpservergitphp git server

### Embed Badge

![Health badge](/badges/rcs-us-php-git-server/health.svg)

```
[![Health](https://phpackages.com/badges/rcs-us-php-git-server/health.svg)](https://phpackages.com/packages/rcs-us-php-git-server)
```

###  Alternatives

[felixfbecker/language-server-protocol

PHP classes for the Language Server Protocol

22581.4M6](/packages/felixfbecker-language-server-protocol)[php-mcp/server

PHP SDK for building Model Context Protocol (MCP) servers - Create MCP tools, resources, and prompts

850577.8k50](/packages/php-mcp-server)[renoki-co/laravel-healthchecks

Laravel Healthchecks is a simple controller class that helps you build your own healthchecks endpoint without issues.

5755.0k](/packages/renoki-co-laravel-healthchecks)[brunodebarros/git-deploy-php

git-deploy-php is a simple php-based tool that deploys your Git repositories to FTP/SFTP servers, and keeps them updated automatically.

2941.2k](/packages/brunodebarros-git-deploy-php)[appserver-io/webserver

Multithreaded webserver for php written in php

465.8k1](/packages/appserver-io-webserver)[mmoreram/translation-server

PHP translation server

233.8k2](/packages/mmoreram-translation-server)

PHPackages © 2026

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