PHPackages                             avtomon/sami-markdown - 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. avtomon/sami-markdown

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

avtomon/sami-markdown
=====================

Fork of https://git.giaever.org/joachimmg/sami-markdown

1.0.0(6y ago)0551PHP

Since Jan 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/avtomon/sami-markdown)[ Packagist](https://packagist.org/packages/avtomon/sami-markdown)[ RSS](/packages/avtomon-sami-markdown/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (2)Versions (2)Used By (1)

Sami Markdown Extension
=======================

[](#sami-markdown-extension)

Table of content
================

[](#table-of-content)

1. [Markdown](#markdown "Markdown")
    1. [SamiTwigExtension](#samitwigextension-markdown "Markdown\SamiTwigExtension") An extension than builds a single ReadMe markdownfile out of your code.

---

Documentation
-------------

[](#documentation)

Markdown
========

[](#markdown)

Classes
-------

[](#classes)

### SamiTwigExtension `Markdown`

[](#samitwigextension-markdown)

- Class extends [Twig\_Extension](https://www.google.no/search?q=Twig_Extension)

An extension than builds a single ReadMe markdown file out of your code.

By now, most is done "behind the scene" and the template is very minimal. This means that it's not much you can do to change any of the layout etc, without editing the actual code/class, but you may want to change template structure by calling the methods "render\_classes", "render\_class" etc, but be aware that these methods does not remove whitespaces and takes care of any format issues your template will get.

This is in lack of a a single-file-documentation, for a project, and since the markdown language is very strict on format - (indentation, signs etc.) - using the twig template was a hassle, whitout ending with several "twig-files" that was unreadable (no indentation etc).

Get [Sami](https://github.com/FriendsOfPHP/Sami/) and fork this repo

```
git clone giaever@git.giaever.org:joachimmg/sami-markdown.git
```

Include the `SamiTwigExtension.php` into your Sami configuration-file and add it to twig. See `example.conf.php` or

- set template: `"template" => "markdown"`
- add extension:

```
$sami["twig"]->addExtension(new Markdown\SamiTwigExtension());
```

#### Methods

[](#methods)

NameReturnAccessDescription[\_\_construct](#__construct-markdownsamitwigextension)public[getFunctions](#getfunctions-markdownsamitwigextension)publicSet the functions available for the template engine.[short\_description](#short_description-markdownsamitwigextension)string ***v*** nullpublic staticReturns the short description of a reflection.[long\_description](#long_description-markdownsamitwigextension)string ***v*** nullpublic staticReturns a long description (both short and long) of a reflection.[deprecated](#deprecated-markdownsamitwigextension)string ***v*** nullpublic staticReturnes a deprecated label if class, method etc is.[todo](#todo-markdownsamitwigextension)array ***v*** nullpublic staticReturns todo-tag for Reflection.[see](#see-markdownsamitwigextension)array ***v*** nullpublic staticReturns see-tag for Reflection.[href](#href-markdownsamitwigextension)stringpublic staticReturnes a markdown link.[toc](#toc-markdownsamitwigextension)stringpublic staticTabel of contents[param\_hint](#param_hint-markdownsamitwigextension)stringpublic staticGet hints of a param.[param\_default](#param_default-markdownsamitwigextension)string ***v*** nullpublic staticGet default for parameter.[method\_hint](#method_hint-markdownsamitwigextension)stringpublic staticGet the methods hints.[method\_access](#method_access-markdownsamitwigextension)stringpublic staticGet access to method.[method\_signature](#method_signature-markdownsamitwigextension)stringpublic staticGet signature of a method.[method\_source\_url](#method_source_url-markdownsamitwigextension)stringpublic staticReturn a link to method in source code.[render\_methods](#render_methods-markdownsamitwigextension)string ***v*** nullpublic staticRender methods.[render\_class](#render_class-markdownsamitwigextension)stringpublic staticRender class[render\_classes](#render_classes-markdownsamitwigextension)string ***v*** nullpublic staticRender one or more classes.[render\_namespace](#render_namespace-markdownsamitwigextension)stringpublic staticRender namespace.[render](#render-markdownsamitwigextension)stringpublic staticRender the whole ReadMe.#### Method details

[](#method-details)

##### \_\_construct `Markdown\SamiTwigExtension`

[](#__construct-markdownsamitwigextension)

```
public function __construct(bool $pretty_print = false);
```

Parameters

TypeVariableDescriptionbool$pretty\_print*None*---

##### getFunctions `Markdown\SamiTwigExtension`

[](#getfunctions-markdownsamitwigextension)

```
public function getFunctions();
```

Set the functions available for the template engine.

---

##### short\_description `Markdown\SamiTwigExtension`

[](#short_description-markdownsamitwigextension)

```
public static function short_description(Reflection $refl, bool $oneliner = true, int $max = -1);
```

Returns the short description of a reflection.

Parameters

TypeVariableDescriptionReflection$reflReflection to return description ofbool$onelinerRemoves every newline and tabulation.int$maxMaximum of lettersReturns: string ***v*** null

---

##### long\_description `Markdown\SamiTwigExtension`

[](#long_description-markdownsamitwigextension)

```
public static function long_description(Reflection $refl, bool $oneliner = false);
```

Returns a long description (both short and long) of a reflection.

Parameters

TypeVariableDescriptionReflection$reflReflection to return description ofbool$onelinerRemoves every newline and tabulationReturns: string ***v*** null

---

##### deprecated `Markdown\SamiTwigExtension`

[](#deprecated-markdownsamitwigextension)

```
public static function deprecated(Reflection $refl, bool $notice = true);
```

Returnes a deprecated label if class, method etc is.

If `$notice` is false, it will include the deprecated note - if given in the documentation.

Parameters

TypeVariableDescriptionReflection$reflReflectionbool$noticeJust as noticeReturns: string ***v*** null

---

##### todo `Markdown\SamiTwigExtension`

[](#todo-markdownsamitwigextension)

```
public static function todo(Reflection $refl);
```

Returns todo-tag for Reflection.

Parameters

TypeVariableDescriptionReflection$reflReflection to get todo tag from.Returns: array ***v*** null

---

##### see `Markdown\SamiTwigExtension`

[](#see-markdownsamitwigextension)

```
public static function see(Reflection $refl);
```

Returns see-tag for Reflection.

Parameters

TypeVariableDescriptionReflection$reflReflection to get see-tag from.Returns: array ***v*** null

---

##### href `Markdown\SamiTwigExtension`

[](#href-markdownsamitwigextension)

```
public static function href(string $ltxt, string $lurl, bool $namespace = false, string $desc = null);
```

Returnes a markdown link.

To match the markdown template classes is linked to by `#classname-namespace`, and methods `#method-namespace\classname`and namespaces is linked to by `#namespace`, `$namespace` must be set to true when linking to it.

Parameters

TypeVariableDescriptionstring$ltxtThe link textstring$lurlThe link destinationbool$namespaceTrue when linking to a namespacestring$descLink title (like the html title/hover-tag)Returns: string

---

##### toc `Markdown\SamiTwigExtension`

[](#toc-markdownsamitwigextension)

```
public static function toc(array $tree, int $depth);
```

Tabel of contents

Generates a table of contentes out of the whole project tree.

Parameters

TypeVariableDescriptionarray$treeThe tree array passed from twigint$depthdepth Initially this should be 0Returns: string

---

##### param\_hint `Markdown\SamiTwigExtension`

[](#param_hint-markdownsamitwigextension)

```
public static function param_hint(ParameterReflection $param, bool $link = false);
```

Get hints of a param.

This could be `string`, `bool` etc or several if an parameter can be `mixed`. If it's not stated in the functions signature, the hint will automatically be `mixed`.

If the hint is a part of this package (root namespace), and `link` is set to `true` it will return an internal link to the type, but if link is set to true and the type is

- [...](http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list),
- [iterable](http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration.types) or
- something else

it will either return a link to this type or add a Google search query-link.

Parameters

TypeVariableDescriptionParameterReflection$paramThe parameterbool$linkSet to true to linkReturns: string

---

##### param\_default `Markdown\SamiTwigExtension`

[](#param_default-markdownsamitwigextension)

```
public static function param_default(ParameterReflection $param);
```

Get default for parameter.

Parameters

TypeVariableDescriptionParameterReflection$param*None*Returns: string ***v*** null

---

##### method\_hint `Markdown\SamiTwigExtension`

[](#method_hint-markdownsamitwigextension)

```
public static function method_hint(MethodReflection $method, bool $link = false);
```

Get the methods hints.

This hints is typically what a method returns, e.g `string`, `bool` etc.

Method works similar as `param_hint`.

Parameters

TypeVariableDescriptionMethodReflection$method*None*bool$link= falseReturns: string

---

##### method\_access `Markdown\SamiTwigExtension`

[](#method_access-markdownsamitwigextension)

```
public static function method_access(MethodReflection $method);
```

Get access to method.

Returns if a method is abstract, final, protected etc. Access to a method can be a mix and this method will include every.

Parameters

TypeVariableDescriptionMethodReflection$method*None*Returns: string

---

##### method\_signature `Markdown\SamiTwigExtension`

[](#method_signature-markdownsamitwigextension)

```
public static function method_signature(MethodReflection $method, bool $incname = true);
```

Get signature of a method.

Returns the function name, parameters and access. It also includes default parameter values if `$incname` is set to true.

The format will be

```
access function name(paramterers [= "value"]);
```

Parameters

TypeVariableDescriptionMethodReflection$methodMethod reflectionbool$incnameAdds default parameter values on trueReturns: string

---

##### method\_source\_url `Markdown\SamiTwigExtension`

[](#method_source_url-markdownsamitwigextension)

```
public static function method_source_url(MethodReflection $method);
```

Return a link to method in source code.

Parameters

TypeVariableDescriptionMethodReflection$methodMethodReflection $method Method reflectionReturns: string

---

##### render\_methods `Markdown\SamiTwigExtension`

[](#render_methods-markdownsamitwigextension)

```
public static function render_methods(array $methods);
```

Render methods.

Returns a summary and detailed description of every method in the method array.

Parameters

TypeVariableDescriptionarray$methods*None*Returns: string ***v*** null

---

##### render\_class `Markdown\SamiTwigExtension`

[](#render_class-markdownsamitwigextension)

```
public static function render_class(ClassReflection $class);
```

Render class

Returns information about a class including it's methods.

Parameters

TypeVariableDescriptionClassReflection$classClass reflectionReturns: string

---

##### render\_classes `Markdown\SamiTwigExtension`

[](#render_classes-markdownsamitwigextension)

```
public static function render_classes(array $classes);
```

Render one or more classes.

Should typically be used for a single namespace at the time.

Determines which kind of class (e.g trait, interface etc) and returns them in the structure/order

Namespace

- Normal classes,
- Traits,
- Interfaces,
- Exceptions.

Parameters

TypeVariableDescriptionarray$classesArray with ClassReflectionReturns: string ***v*** null

---

##### render\_namespace `Markdown\SamiTwigExtension`

[](#render_namespace-markdownsamitwigextension)

```
public static function render_namespace(string $namespace, array $namespaces, array $classes);
```

Render namespace.

Returns information about the whole namespace, as long as it's sub-namespaces and classes is passed along to the method.

Parameters

TypeVariableDescriptionstring$namespaceThe name of the namespacearray$namespacesArray with names of sub-namespacesarray$classesArray with ClassReflectionsReturns: string

---

##### render `Markdown\SamiTwigExtension`

[](#render-markdownsamitwigextension)

```
public static function render(array $namespaces, array $classes);
```

Render the whole ReadMe.

Will bind classes and it's sub-namespaces and render namespace for namespace.

Parameters

TypeVariableDescriptionarray$namespacesArray with names of namespacesarray$classesArray with ClassReflectionsReturns: string

---

- Genetated using Sami and the [Sami/Twig Markdown Extension](https://git.giaever.org/joachimmg/sami-markdown)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2317d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10077243?v=4)[Aleksandr Avtomonov](/maintainers/avtomon)[@avtomon](https://github.com/avtomon)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/avtomon-sami-markdown/health.svg)

```
[![Health](https://phpackages.com/badges/avtomon-sami-markdown/health.svg)](https://phpackages.com/packages/avtomon-sami-markdown)
```

###  Alternatives

[symfony/polyfill-intl-grapheme

Symfony polyfill for intl's grapheme\_\* functions

1.7k702.8M27](/packages/symfony-polyfill-intl-grapheme)[wp-cli/wp-config-transformer

Programmatically edit a wp-config.php file.

859.7M6](/packages/wp-cli-wp-config-transformer)[prestashop/blockreassurance

PrestaShop module blockreassurance

187.2M2](/packages/prestashop-blockreassurance)[xefi/faker-php

Faker allows you to generate realistic fake data for your php applications

15116.5k15](/packages/xefi-faker-php)

PHPackages © 2026

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