Giter VIP home page Giter VIP logo

phpdoc-markdown-public's Introduction

phpDocumentor markdown-public template

phpDocumentor template that generates Markdown documentation of only the public API. It will skip all abstract classes and non-public methods.

The main use-case for this template is to generate simple and nice looking usage documentation, that can then be published on GitHub.

For example, a small library can document it's public API in DocBlock comments, use this template to generate the Markdown documentation and then commit it to GitHub with the library to easily create a nice looking documentation for other developers to see.

Example of documentation generated with this template: https://github.com/cvuorinen/raspicam-php/tree/master/docs

Installation

Install with composer:

composer require cvuorinen/phpdoc-markdown-public

Usage

Run phpDocumentor and set template as vendor/cvuorinen/phpdoc-markdown-public/data/templates/markdown-public.

Example using command-line arguments:

./vendor/bin/phpdoc --directory=src/ --target=docs/ --template="vendor/cvuorinen/phpdoc-markdown-public/data/templates/markdown-public" --title="My Project Documentation"

More information about the available arguments can be found at running phpDocumentor.

Example using configuration file:

Add a file called phpdoc.xml with the following content to the root of your project and invoke the phpdoc command without arguments. Modify the configuration to suit your project.

<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
    <title>My Project Documentation</title>
    <parser>
        <target>build</target>
    </parser>
    <transformer>
        <target>docs</target>
    </transformer>
    <transformations>
        <template name="vendor/cvuorinen/phpdoc-markdown-public/data/templates/markdown-public" />
    </transformations>
    <files>
        <directory>src</directory>
        <ignore>test/*</ignore>
    </files>
</phpdoc>

More information about configuring phpDocumentor.

phpdoc-markdown-public's People

Contributors

cvuorinen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

phpdoc-markdown-public's Issues

See also and Link tags improperly rendered if more than one.

Suggested Fix:

In Markdown, two spaces followed by a return signifies a new line. Adding the two spaces at the end of the line that outputs the bullet items in the classes and methods twig files will cause subsequent entries to be a new element in the list.

Doesn't work properly with PHP 7.2

I'm trying to parse some class and apparently it crash when a class implements Countable interface.

PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /home/max/Desktop/documentator/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Plugin/Core/Descriptor/Validator/Constraints/Functions/IsArgumentInDocBlockValidator.php on line 33

Also, it doesn't recognize nullable return types, if one of your classes use nullable return types like the following:

public function get() ?StdClass
{
    //...
}

You end up with an error like this:

Parse Error: Syntax error, unexpected '?' on line 100

Move phpDocumentor to DEV dependencies in composer.json

I have phpdocumentor/phpdocumentor global installed because in my project causes conflicts.

Tryin to install this theme causes conflicts due to phpDocumentor dependencies.

Should be nice if moved to requireDev in composer.json in order to use it when phpdoc is installed via composer global, and not as a project dependency.

Not working?

I'm interested in this project, but can't get it to actually output documentation. All I get is:

Preparing template "vendor/cvuorinen/phpdoc-markdown-public/data/t .. 

  [Symfony\Component\Filesystem\Exception\IOException]                                                                 
  Failed to create "/Users/{redacted}/vendor/phpdocumentor/phpdocumentor/src/ph  
  pDocumentor/Transformer/../../../data/templates/markdown-public": Undefined variable: undefinedVariable.             

Native types being assigned to current namespace

When generating documentation for a class under a namespace, certain types seem to be mapped to the namespace instead of remaining their native PHP types.

For instance,

namespace My\Awesome\Library;

class Person {
    public function waveTo(string $name, array $opts = []) {
        return "Waved to $name";
    }
}

Produces documentation looking like:

### waveTo

``php
Person::waveTo( \My\Awesome\Library\string $key,  array $opts = [] ): string
``

**Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| `$name` | **\My\Awesome\Library\string** |  |
| `$opts` | **array** |  |

When obviously this is a native string identifier, and adding \string to the function causes PHP to throw a syntax error. What I don't understand is where this template is excluding array, otherwise I'd just add string to the list of native classes to ignore!

Any ideas where this can be done? It's a pretty perfect template otherwise!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.