PHPackages                             noem/composer-file-embed - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. noem/composer-file-embed

ActiveComposer-plugin[Parsing &amp; Serialization](/categories/parsing)

noem/composer-file-embed
========================

description

1896PHPCI failing

Since Jan 27Pushed 1y agoCompare

[ Source](https://github.com/NoemPHP/composer-file-embed)[ Packagist](https://packagist.org/packages/noem/composer-file-embed)[ RSS](/packages/noem-composer-file-embed/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Composer File Embed
===================

[](#composer-file-embed)

A composer plugin that allows embedding files as code snippets in your markdown docs

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

[](#installation)

Install this package via composer:

`composer require noem/composer-file-embed`

Usage
-----

[](#usage)

The plugin parses Markdown's ["hidden link syntax"](https://stackoverflow.com/a/20885980) which can otherwise used for comments, in a custom format. This allows us to define embeds without these definitions showing up in the generated output. The following formats are all valid, so in case your markdown processor trips over one, you can try a different format:

```
[embed]:# (path: filepathOrURL, lang: language, match: '[a-zA-Z]')

[embed]: (path: filepathOrURL, lang: language, match: '[a-zA-Z]')

[embed]:# "path: filepathOrURL, lang: language, match: '[a-zA-Z]'"
```

The config inside the parentheses is actually an inline YAML string, so commas and spaces are important. Don't forget to quote your config when encessary. Only the `path` is required.

KeyTypeRequiredExampleCommentpath`string`yes`./src/MyClass.php`Path or URL to the text you want to embedlang`string`no`php`Specify the language in case in it cannot be (correctly) identifiedmatch`string`no`class.*}`Include only the matching parts of the specified file. Default: `^.*$`Since only the `path` is required, you can simply do

```
[embed]:# (path: path/to/file.php)
```

...to embed a full file.

[Check out the Examples page](https://noemphp.github.io/composer-file-embed/Examples/) for more detailed examples and use-cases.

After you made changes to your documents, use the new CLI command to process all `*.md` files in the current directory. It will recurse into subdirectories, but exclude the `vendor/` folder.

In your project directory, run:

```
composer embed-files
```

Notes
-----

[](#notes)

**When using Jekyll / GH-Pages**, the comment markup can break if you use quotes in your YAML. The result is that the `[embed]` definition is visible on GH Pages despite not being rendered on GitHub itself. Try a different format then. For example, if you need to pass a single-quoted regex pattern, the use of double quotes in the comment is known to work:

```
[embed]:# "path: ./foo.md, match: '##\sThanks.*$'"
```

Thanks
------

[](#thanks)

- @campoy for [campoy/embed](https://github.com/campoy/embed) which was a huge inspiration.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/16e124446e13d0c8773106688a571f7afc645474750a5d8e7489e568f67d2822?d=identicon)[Biont](/maintainers/Biont)

---

Top Contributors

[![Biont](https://avatars.githubusercontent.com/u/4208996?v=4)](https://github.com/Biont "Biont (66 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

composercomposer-pluginembedmarkdownphp

### Embed Badge

![Health badge](/badges/noem-composer-file-embed/health.svg)

```
[![Health](https://phpackages.com/badges/noem-composer-file-embed/health.svg)](https://phpackages.com/packages/noem-composer-file-embed)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M283](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M226](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M63](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M344](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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