barnythorpe/clarify

A CLI command for your PHP projects to convert PHPDoc into MarkDown based documentation.

0.1.0 2025-04-16 11:01 UTC

This package is auto-updated.

Last update: 2025-05-16 11:05:19 UTC


README

   ________  ___       ________  ________  ___  ________ ___    ___ 
  |\   ____\|\  \     |\   __  \|\   __  \|\  \|\  _____\\  \  /  /|
  \ \  \___|\ \  \    \ \  \|\  \ \  \|\  \ \  \ \  \__/\ \  \/  / /
   \ \  \    \ \  \    \ \   __  \ \   _  _\ \  \ \   __\\ \    / / 
    \ \  \____\ \  \____\ \  \ \  \ \  \\  \\ \  \ \  \_| \/  /  /  
     \ \_______\ \_______\ \__\ \__\ \__\\ _\\ \__\ \__\__/  / /    
      \|_______|\|_______|\|__|\|__|\|__|\|__|\|__|\|__|\___/ /     
                                                       \|___|/      

Convert PHPDoc comments into structured Markdown documentation with ease.

About

This project provides a PHP-based documentation generator that extracts PHPDoc comments from your code and converts them into Markdown files. Using a flexible configuration system, it allows you to customize the output structure with a comprehensible fluent interface.

🔧 Installation

1️⃣ Install via Composer:

composer require --dev barnythorpe/clarify

2️⃣ Run the Documentation Generator:

./vendor/bin/clarify build --config=clarify.config.php

or add to your composer.json as a script like so:

"scripts": {
   "doc": "clarify"
},

and run:

composer doc

🛠 Configuration Example

Create a config file clarify.config.php:

<?php
use Barnythorpe\clarify\DocBuilder;
use Barnythorpe\clarify\OutputStrategies\MarkdownStrategy;

return DocBuilder::make()
    ->setOutputStrategy(new MarkdownStrategy())
    ->startPage('docs/api.md'))
        ->addHeading('API Documentation', 1)
        ->addParagraph('This is an example doc.')
        ->addFile('src/Example.php')
    ->endPage();