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

11.3kPHPCI 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 3w ago

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 13% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity22

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

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19139.2M47](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9843.5k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

45153.1k6](/packages/jstewmc-rtf)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

113.2k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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