PHPackages                             ncuesta/pinocchio - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ncuesta/pinocchio

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ncuesta/pinocchio
=================

Annotated Source generator for PHP (port of Docco)

1.0.0(12y ago)112.6k[3 issues](https://github.com/ncuesta/pinocchio/issues)2MITPHPPHP &gt;=5.3.6

Since May 7Pushed 12y ago1 watchersCompare

[ Source](https://github.com/ncuesta/pinocchio)[ Packagist](https://packagist.org/packages/ncuesta/pinocchio)[ Docs](http://ncuesta.github.com/pinocchio)[ RSS](/packages/ncuesta-pinocchio/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (2)Used By (2)

Pinocchio
=========

[](#pinocchio)

[![Build Status](https://camo.githubusercontent.com/23b3bad20ba2b5ff3276ab83d59007d5b19a68e57bbb04d742bae0b3124102cd/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6e6375657374612f70696e6f636368696f2e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/ncuesta/pinocchio)

Annotated Source generator for PHP (port of [Docco](http://jashkenas.github.com/docco)). This library has been inspired by [Phrocco](https://github.com/oneblackbear/phrocco).

**Pinocchio** crawls the source files on a project and automatically generates annotated source HTML pages that serve both as self-documented projects and API-like documentation.

You may see the [annotated source of **Pinnochio**](http://ncuesta.github.com/pinocchio/docs/index.html), for an example.

Key benefits
------------

[](#key-benefits)

- Easy to use
- Almost no requirements (only PHP &gt;= 5.3.6)
- Configurable and customizable
- Makes projects self-documented

Installation
------------

[](#installation)

You can install **Pinocchio** using [Composer](http://getcomposer.org). It is more likely that you'll use **Pinocchio** as a development library and not as one that will actually be required for the use of your project, so you might want to use it as a `dev` requirement in your `composer.json` file like this:

```
{
    "require-dev": {
        "ncuesta/pinocchio": "dev-master"
    }
}
```

Once you have that, you can `install` it providing the `--dev` flag:

```
$ composer install --dev
```

If Composer complains about stability issues, you might need to add a `minimum-stability`key to the `composer.json` file like follows:

```
{
    "require-dev": {
        "ncuesta/pinocchio": "dev-master"
    },
    "minimum-stability": "dev"
}
```

Usage
-----

[](#usage)

Once installed via [Composer](http://getcomposer.org) you can use **Pinocchio**directly from the command-line interface as follows. Please note that `vendor/bin/pinocchio` is the path to **Pinocchio**'s executable, and that `vendor/bin` is the directory in which [Composer](http://getcomposer.org)installs any vendor binary files by default. If you have changed this path, be sure that you are running **Pinocchio** from your specific one.

So, running:

```
$ php vendor/bin/pinocchio
```

will crawl for any source files under `./src` directory and will generate their corresponding annotated source files under `./output`. See below for further customization of this behavior.

Configuration
-------------

[](#configuration)

**Pinocchio** can be configured in many ways. You can provide your configuration options when running the script, have your settings taken from a configuration file located on the root of your project, or a combination of both.

The order in which option sources are considered is:

1. Command-line arguments
2. Configuration file values
3. Default values

### Configuration options

[](#configuration-options)

Here is a list of all the configuration options and their acceptable values:

- `source` (`string`): The path to the source directory to crawl for sources.
- `output` (`string`): The path to the output directory in which generated files will be saved.
- `template` (`string`): The path to the template to use for each source file.
- `css` (`array`): A set of CSS files to use inside the template.
- `ignore` (`string`): A regular expression that if matched by any path inside the `source` directory, will exclude such path from the crawled files.
- `silent` (`boolean`): A value indicating whether the logger should be silent or output things.
- `logger` (`string`): A fully-qualified class name to use as Logger class. This class *should* implement `\Pinocchio\Logger\LoggerInterface`.
- `logger_opts` (`array`): A set of options that will be provided to the Logger upon its initialization. Note that the default Logger class does not take any option into account.
- `skip_index` (`boolean`): If `true`, no index file will be generated. Otherwise, an `index.html` file will be created at the `output` directory with links to the different files, as presented in the `index_template` template.
- `index_template` (`string`): The path to the template to use for the index file. Only applicable when `skip_index` is `true`.
- `index_title` (`string`): The title to add to the index file.

### Configuration as arguments

[](#configuration-as-arguments)

When running **Pinocchio** you can pass arguments that will be considered as configuration options. For instance:

```
$ php vendor/bin/pinocchio --source src --output annotated-source
```

Will tell **Pinocchio** that the `source` option has been set to `src` and `output` to `annotated-source`.

### Configuration file

[](#configuration-file)

If a file named `pinocchio.json` is found at the directory in which you invoke **Pinocchio** (namely your project's root), it will be used as an configuration source. For instance:

```
{
    "source":   "lib",
    "output":   "doc",
    "template": "path/to/some/template.php",
    "css":      ["stylesheet_1.css", "path/to/stylesheet_2.css"],
    "ignore":   "/ignore\s+me\s+regex/i",
    "silent":   true
}
```

### Default values

[](#default-values)

All configuration values have a sensible default value so that you *don't have to*configure anything. Here is a list of all the default values for the different configuration options:

- `source`: `'src'`.
- `output`: `'output'`.
- `template`: A built-in template based on [Docco](http://jashkenas.github.com/docco)'s template.
- `css`: A built-in stylesheet based on [Docco](http://jashkenas.github.com/docco)'s stylesheet.
- `ignore`: `'/^\./'`. Dot-files are ignored by default.
- `silent`: `false`. Everything is logged by default. Don't worry, it's not *that* verbose.
- `logger`: `'\Pinocchio\Logger\StandardLogger'`. Default class, you can specify a fully-qualified one if you want. Please note that it should implement `\Pinocchio\Logger\LoggerInterface`.
- `logger_opts`: `[]` (an empty array). No options are provided to the logger by default.
- `skip_index`: `false`.
- `index_template`: A built-in template that simply links to every parsed source file.
- `index_title`: `'Source files'`.

Contributing
------------

[](#contributing)

**Pinocchio** is an Open Source project and hence any collaborations, suggestions or whatsoever are welcome. For any of those matters, please use the [Issues](https://github.com/ncuesta/pinocchio/issues)or create Pull Requests.

License
-------

[](#license)

**Pinocchio** is licensed under the **MIT** License. Here you have the boring legal stuff:

```
Copyright (c) 2012 José Nahuel Cuesta Luengo

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.7% 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

4436d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/95592?v=4)[Nahuel Cuesta Luengo](/maintainers/ncuesta)[@ncuesta](https://github.com/ncuesta)

---

Top Contributors

[![ncuesta](https://avatars.githubusercontent.com/u/95592?v=4)](https://github.com/ncuesta "ncuesta (29 commits)")[![hijarian](https://avatars.githubusercontent.com/u/967464?v=4)](https://github.com/hijarian "hijarian (1 commits)")

---

Tags

documentationgeneratorsourceannotated

### Embed Badge

![Health badge](/badges/ncuesta-pinocchio/health.svg)

```
[![Health](https://phpackages.com/badges/ncuesta-pinocchio/health.svg)](https://phpackages.com/packages/ncuesta-pinocchio)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k116.2M674](/packages/symfony-maker-bundle)[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k29.5M105](/packages/simplesoftwareio-simple-qrcode)[genericmilk/docudoodle

Generate documentation for your Laravel application using OpenAI

15328.7k](/packages/genericmilk-docudoodle)[easycorp/easy-doc-bundle

Symfony application documentation generator

1021.0k](/packages/easycorp-easy-doc-bundle)

PHPackages © 2026

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