项目作者: dennisverspuij

项目描述 :
Sami RemoteRepository implementation for including source code along documentation.
高级语言: PHP
项目地址: git://github.com/dennisverspuij/sami-local-source.git
创建时间: 2018-09-10T11:30:59Z
项目社区:https://github.com/dennisverspuij/sami-local-source

开源协议:MIT License

下载


Sami local source

The PHP API documentation generator Sami can be configured to embed hyperlinks to the source code. So far only remote repositories at Github are supported. This library adds support for exposing the source code together with the generated documentation itself. Currently using GeSHi, though other highlighters like FSHL or scrivo/highlight could be easily supported by extending Base.

Installation

In combination with sami.phar

Create a directory e.g. /some/path/sami-local-source with a composer.json containing:

  1. {
  2. "repositories": [
  3. { "type": "vcs", "url": "https://github.com/dennisverspuij/sami-local-source.git" }
  4. ],
  5. "require": {
  6. "dennisverspuij/sami-local-source": "dev-master",
  7. "geshi/geshi": "^1"
  8. }
  9. }

Install using composer:

  1. cd /some/path/sami-local-source
  2. composer install

And prepend your Sami project configuration file with:

  1. require_once('/some/path/sami-local-source/vendor/autoload.php');

Install sami together with this library at once

Create a directory e.g. /some/path/sami with a composer.json containing:

  1. {
  2. "repositories": [
  3. { "type": "vcs", "url": "https://github.com/dennisverspuij/sami-local-source.git" }
  4. ],
  5. "require": {
  6. "sami/sami": "^4",
  7. "dennisverspuij/sami-local-source": "dev-master",
  8. "geshi/geshi": "^1"
  9. }
  10. }

Install using composer:

  1. cd /some/path/sami
  2. composer install
  3. # You can now invoke sami as follows:
  4. php /some/path/sami/vendor/bin/sami.php ...

Configuration

Complement your Sami project configuration file like:

  1. <?php
  2. # ...
  3. # $sami = new \Sami\Sami('/path/to/src', ...); # or
  4. # $sami = new \Sami\Sami(\Symfony\Component\Finder\Finder::create()->in(array('/path/to/src/a', '/path/to/src/b', '...')), ...);
  5. $sami['remote_repository'] = function() use($sami) {
  6. return new \DennisVerspuij\SamiLocalSource\GeSHi($sami, '/path/to/src', array('b','...'));
  7. };
  8. # ...
  9. # return $sami;

Note that you need to have a common /path/to/src root for the input source files, otherwise it won’t work. The third array parameter is a list of relative paths to this root to exclude, just omit the array if you want all sources to be visitable.