PHPackages                             berlioz/php-doc - 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. berlioz/php-doc

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

berlioz/php-doc
===============

Berlioz PhpDoc is a PHP library to read the documentations in code (classes, methods and functions) with advanced annotation interpretation.

v1.2.0(2mo ago)19.3k↓32.1%1MITPHPPHP ^7.1 || ^8.0CI passing

Since Feb 14Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/BerliozFramework/PhpDoc)[ Packagist](https://packagist.org/packages/berlioz/php-doc)[ Docs](https://getberlioz.com)[ RSS](/packages/berlioz-php-doc/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (1)

Berlioz PhpDoc
==============

[](#berlioz-phpdoc)

[![Latest Version](https://camo.githubusercontent.com/63a80fa9756a42c05a7ce675b3f4980dd1c73f9e6cedd01d4fec6e8db0667834/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6265726c696f7a2f7068702d646f632e7376673f7374796c653d666c61742d737175617265)](https://github.com/BerliozFramework/PhpDoc/releases)[![Software license](https://camo.githubusercontent.com/00f7b995b6494c3d49ced990f3c6cfc66710eb3e4bcf95e4485bbf2781f9a1ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4265726c696f7a4672616d65776f726b2f506870446f632e7376673f7374796c653d666c61742d737175617265)](https://github.com/BerliozFramework/PhpDoc/blob/main/LICENSE)[![Build Status](https://camo.githubusercontent.com/365908c99c44aebcbad6db097e9582d3f6bde28a401fdd95706850ff375b7d39/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f4265726c696f7a4672616d65776f726b2f506870446f632f54657374732f6d61696e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/BerliozFramework/PhpDoc/actions/workflows/tests.yml?query=branch%3Amain)[![Quality Grade](https://camo.githubusercontent.com/b69f2580cca16f4b706d2f42de091d0e5f26b55f4524271f1fccc70c1b8c2460/68747470733a2f2f696d672e736869656c64732e696f2f636f646163792f67726164652f66666439633739393164616534386635626464623730316434343238356537362f6d61696e2e7376673f7374796c653d666c61742d737175617265)](https://www.codacy.com/manual/BerliozFramework/PhpDoc)[![Total Downloads](https://camo.githubusercontent.com/5d77737bf86de2cf2694fa49b55773c2f2c3a2ef9d87cecf7da3873ad9b8a307/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6265726c696f7a2f7068702d646f632e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/berlioz/php-doc)

**Berlioz PhpDoc** is a PHP library to read the documentations in code (classes, methods and functions) with advanced annotation interpretation.

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

[](#installation)

### Composer

[](#composer)

You can install **Berlioz PhpDoc** with [Composer](https://getcomposer.org/), it's the recommended installation.

```
$ composer require berlioz/php-doc
```

### Dependencies

[](#dependencies)

- **PHP** ^7.1 || ^8.0
- Packages:
    - **psr/simple-cache**
    - **psr/log**

Usage
-----

[](#usage)

### Basic

[](#basic)

```
$phpDocFactory = new PhpDocFactory;

// To get class PhpDoc
$doc = $phpDocFactory->getClassDoc(ClassOfMyProject::class);

// To get class property PhpDoc
$doc = $phpDocFactory->getPropertyDoc(ClassOfMyProject::class, 'myProperty');

// To get class method PhpDoc
$doc = $phpDocFactory->getMethodDoc(ClassOfMyProject::class, 'myMethod');

// To get function PhpDoc
$doc = $phpDocFactory->getFunctionDoc('myFunction');
```

### Cache

[](#cache)

The library supports PSR-16 (Common Interface for Caching Libraries).

To use it, you need to pass the cache manager in first argument of `PhpDocFactory` class.

```
$simpleCacheManager = new MySimpleCacheManager;

$phpDocFactory = new PhpDocFactory($simpleCacheManager);
```

So you do disk i/o economies and your application will be faster than if you don't use cache manager.

Berlioz\\PhpDoc\\DocBlock class
-------------------------------

[](#berliozphpdocdocblock-class)

A `DocBlock` class or an array of them are returned when you call these methods of factory:

- `PhpDocFactory::getClassDocs()` returns an array of `Berlioz\PhpDoc\DocBlock`
- `PhpDocFactory::getClassDoc()` returns a `Berlioz\PhpDoc\DocBlock\ClassDocBlock` object
- `PhpDocFactory::getPropertyDoc()` returns a `Berlioz\PhpDoc\DocBlock\PropertyDocBlock` object
- `PhpDocFactory::getMethodDoc()` returns a `Berlioz\PhpDoc\DocBlock\MethodDocBlock` object
- `PhpDocFactory::getFunctionDoc()` returns a `Berlioz\PhpDoc\DocBlock\FunctionDocBlock` object

Some methods are available with `DocBlock` object:

- `DocBlock::getTitle()` returns the title part in the PhpDoc
- `DocBlock::getDescription()` returns the description part in the PhpDoc
- `DocBlock::getTags()` returns all tags presents in the PhpDoc
- `DocBlock::getTag()` returns a tag present in the PhpDoc
- `DocBlock::hasTag()` returns if a tag is present in the PhpDoc

Additional methods are available with extended `DocBlock`class:

- `Berlioz\PhpDoc\DocBlock\FunctionDocBlock`:
    - `FunctionDocBlock::getName()`: returns the full name of function
    - `FunctionDocBlock::getShortName()`: returns the short name of function
    - `FunctionDocBlock::getNamespaceName()`: returns the namespace name of function
    - `FunctionDocBlock::getClassName()`: returns the name of class
    - `FunctionDocBlock::isDisabled()`: known if function is disabled
    - `FunctionDocBlock::isUserDefined()`: known if it's user defined function
    - `FunctionDocBlock::isInternal()`: known if function is internal
    - `FunctionDocBlock::isClosure()`: known if function is a closure
    - `FunctionDocBlock::isDeprecated()`: known if function is deprecated
    - `FunctionDocBlock::isGenerator()`: known if function is generator
    - `FunctionDocBlock::isVariatic()`: known if function is variatic
- `Berlioz\PhpDoc\DocBlock\ClassDocBlock`:
    - `ClassDocBlock::getName()`: returns the full name of class
    - `ClassDocBlock::getShortName()`: returns the short name of class
    - `ClassDocBlock::getNamespaceName()`: returns the namespace name of class
    - `ClassDocBlock::isAbstract()`: known if class is abstract
    - `ClassDocBlock::isFinal()`: known if class is final
    - `ClassDocBlock::isInternal()`: known if class is internal
    - `ClassDocBlock::isUserDefined()`: known if it's user defined class
    - `ClassDocBlock::isAnonymous()`: known if class is anonymous
    - `ClassDocBlock::isCloneable()`: known if class is cloneable
    - `ClassDocBlock::isInstantiable()`: known if class is instantiable
    - `ClassDocBlock::isInterface()`: known if class is an interface
    - `ClassDocBlock::isIterable()`: known if class is iterable
    - `ClassDocBlock::isIterateable()`: known if class is iterateable
    - `ClassDocBlock::isTrait()`: known if class is a trait
- `Berlioz\PhpDoc\DocBlock\PropertyDocBlock`:
    - `PropertyDocBlock::getName()`: returns the full name of property
    - `PropertyDocBlock::getShortName()`: returns the short name of property
    - `PropertyDocBlock::getNamespaceName()`: returns the namespace name of class
    - `PropertyDocBlock::getClassName()`: returns the name of class
    - `PropertyDocBlock::isPublic()`: known if property has public visibility
    - `PropertyDocBlock::isProtected()`: known if property has protected visibility
    - `PropertyDocBlock::isPrivate()`: known if property has private visibility
    - `PropertyDocBlock::isStatic()`: known if property is static
    - `PropertyDocBlock::isDefault()`: known if property is default
- `Berlioz\PhpDoc\DocBlock\MethodDocBlock`:
    - `MethodDocBlock::getName()`: returns the full name of method
    - `MethodDocBlock::getShortName()`: returns the short name of method
    - `MethodDocBlock::getNamespaceName()`: returns the namespace name of class
    - `MethodDocBlock::getClassName()`: returns the name of class
    - `MethodDocBlock::isConstructor()`: known if method is constructor
    - `MethodDocBlock::isDestructor()`: known if method is destructor
    - `MethodDocBlock::isPublic()`: known if method has public visibility
    - `MethodDocBlock::isProtected()`: known if method has protected visibility
    - `MethodDocBlock::isPrivate()`: known if method has private visibility
    - `MethodDocBlock::isStatic()`: known if method is static
    - `MethodDocBlock::isAbstract()`: known if method is abstract
    - `MethodDocBlock::isFinal()`: known if method is final
    - `MethodDocBlock::isUserDefined()`: known if it's user defined method
    - `MethodDocBlock::isInternal()`: known if method is internal
    - `MethodDocBlock::isClosure()`: known if method is a closure
    - `MethodDocBlock::isDeprecated()`: known if method is deprecated
    - `MethodDocBlock::isGenerator()`: known if method is generator
    - `MethodDocBlock::isVariatic()`: known if method is variatic

Tags
----

[](#tags)

### Formats

[](#formats)

Some tags formats are supported by library and the value returned by `DocBlock` class is a PHP code and not string.

Example:

```
/**
 * Test doc.
 *
 * My description of my method.
 * Multi-line.
 *
 * @test false
 * @novalue
 * @value Only text
 * @test2("test", param1=true, param2="test", param3={"test":"test"})
 * @value Second text
 * @jsonTest {"test":"test"}
 * @jsonArrayTest [{"test":"test"}, {"test2":"test2"}]
 */
```

The result of `DocBlock::getTags()` method is:

```
array(6) {
  ["test"]=>
  array(1) {
    [0]=>
    object(Berlioz\PhpDoc\Tag) (2) {
      ["name":"Berlioz\PhpDoc\Tag":private]=>
      string(4) "test"
      ["value":"Berlioz\PhpDoc\Tag":private]=>
      bool(false)
    }
  }
  ["novalue"]=>
  array(1) {
    [0]=>
    object(Berlioz\PhpDoc\Tag) (2) {
      ["name":"Berlioz\PhpDoc\Tag":private]=>
      string(7) "novalue"
      ["value":"Berlioz\PhpDoc\Tag":private]=>
      NULL
    }
  }
  ["value"]=>
  array(2) {
    [0]=>
    object(Berlioz\PhpDoc\Tag) (2) {
      ["name":"Berlioz\PhpDoc\Tag":private]=>
      string(5) "value"
      ["value":"Berlioz\PhpDoc\Tag":private]=>
      string(9) "Only text"
    }
    [1]=>
    object(Berlioz\PhpDoc\Tag) (2) {
      ["name":"Berlioz\PhpDoc\Tag":private]=>
      string(5) "value"
      ["value":"Berlioz\PhpDoc\Tag":private]=>
      string(11) "Second text"
    }
  }
  ["test2"]=>
  array(1) {
    [0]=>
    object(Berlioz\PhpDoc\Tag) (2) {
      ["name":"Berlioz\PhpDoc\Tag":private]=>
      string(5) "test2"
      ["value":"Berlioz\PhpDoc\Tag":private]=>
      array(4) {
        [0]=>
        string(4) "test"
        ["param1"]=>
        bool(true)
        ["param2"]=>
        string(4) "test"
        ["param3"]=>
        object(stdClass) (1) {
          ["test"]=>
          string(4) "test"
        }
      }
    }
  }
  ["jsonTest"]=>
  array(1) {
    [0]=>
    object(Berlioz\PhpDoc\Tag) (2) {
      ["name":"Berlioz\PhpDoc\Tag":private]=>
      string(8) "jsonTest"
      ["value":"Berlioz\PhpDoc\Tag":private]=>
      object(stdClass) (1) {
        ["test"]=>
        string(4) "test"
      }
    }
  }
  ["jsonArrayTest"]=>
  array(1) {
    [0]=>
    object(Berlioz\PhpDoc\Tag) (2) {
      ["name":"Berlioz\PhpDoc\Tag":private]=>
      string(13) "jsonArrayTest"
      ["value":"Berlioz\PhpDoc\Tag":private]=>
      array(2) {
        [0]=>
        object(stdClass) (1) {
          ["test"]=>
          string(4) "test"
        }
        [1]=>
        object(stdClass) (1) {
          ["test2"]=>
          string(5) "test2"
        }
      }
    }
  }
}

```

### Available tags

[](#available-tags)

Some tags are available by default:

- `Berlioz\PhpDoc\Tag\ParamTag`
- `Berlioz\PhpDoc\Tag\ReturnTag`
- `Berlioz\PhpDoc\Tag\VarTag`

### Extends

[](#extends)

You can extends tags and declare them to the parser. Yours tags must implements TagInterface interface.

```
$phpDocFactory = new PhpDocFactory;
$phpDocFactory->getParser()->addTagClass('tagName', MyTagClass::class);
```

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance86

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Every ~1108 days

Total

3

Last Release

68d ago

PHP version history (2 changes)v1.0.0PHP ^7.1

v1.1.0PHP ^7.1 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18268216?v=4)[Ronan Giron](/maintainers/ElGigi)[@ElGigi](https://github.com/ElGigi)

---

Top Contributors

[![ElGigi](https://avatars.githubusercontent.com/u/18268216?v=4)](https://github.com/ElGigi "ElGigi (33 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/berlioz-php-doc/health.svg)

```
[![Health](https://phpackages.com/badges/berlioz-php-doc/health.svg)](https://phpackages.com/packages/berlioz-php-doc)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

374468.4k51](/packages/flow-php-etl)[gehrisandro/tailwind-merge-php

TailwindMerge for PHP merges multiple Tailwind CSS classes by automatically resolving conflicts between them

1391.5M9](/packages/gehrisandro-tailwind-merge-php)[nelexa/google-play-scraper

Scrapes app data from Google Play store.

88487.4k](/packages/nelexa-google-play-scraper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[llm/mcp-server

PHP SDK for building MCP servers

431.1k](/packages/llm-mcp-server)

PHPackages © 2026

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