# magebitcom/module-documentation

> Module documentation viewer for Magento 2 admin

`composer require magebitcom/module-documentation`

Canonical URL: https://packagento.com/magebitcom/module-documentation

## At a glance

- **Vendor**: magebitcom (https://packagento.com/magebitcom.md)
- **Latest version**: v0.0.1 — released 2026-02-10
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/magebitcom/module-documentation and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require magebitcom/module-documentation:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Module documentation viewer for Magento 2 admin

## README

A Magento 2 module that provides a centralized documentation viewer in the admin panel. View, search, and navigate module documentation.

### Installation

#### Via Composer

```bash
composer require magebitcom/module-documentation
bin/magento module:enable Magebit_Documentation
bin/magento setup:upgrade
```

### Requirements

- PHP 8.1 or higher
- Magento 2.4+

### Quick Start

#### 1. Create Documentation Files

Create a `Docs/` folder in your module with Markdown files:

```
app/code/Vendor/YourModule/
├── Docs/
│   ├── 1-getting-started.md
│   ├── 2-configuration.md
│   └── 3-api-reference.md
├── etc/
│   └── documentation.xml
└── ...
```

#### 2. Register Documentation

Create `etc/documentation.xml` in your module:

```xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magebit_Documentation:etc/documentation.xsd">
    <module name="Vendor_YourModule" title="Your Module" sortOrder="10">
        <documentation name="Getting Started" path="Docs" sortOrder="10"/>
    </module>
</config>
```

#### 3. Clear Cache

```bash
bin/magento cache:flush
```

#### 4. View Documentation

Navigate to **System → Documentation** in the Magento admin panel.

### Configuration

#### Module Attributes

| Attribute | Required | Description |
|-----------|----------|-------------|
| `name` | Yes | Module name (e.g., `Vendor_Module`) |
| `title` | No | Display title in sidebar (defaults to module name) |
| `sortOrder` | No | Module position (lower = higher, default: 100) |
| `icon` | No | Path to icon (e.g., `Vendor_Module::images/icon.svg`) |

#### Documentation Attributes

| Attribute | Required | Description |
|-----------|----------|-------------|
| `name` | Yes | Display name in sidebar |
| `path` | Yes | Path to documentation folder |
| `acl` | No | ACL resource to restrict access |
| `sortOrder` | No | Position within module (lower = higher, default: 100) |

### Path Formats

#### Relative Path
```xml
<documentation name="Guide" path="Docs/Guide"/>
```
Relative to the current module directory.

#### Module Path (Recommended)
```xml
<documentation name="API" path="Vendor_Module::Docs/Api"/>
```
Format: `ModuleName::path/to/docs`

#### Multiple Documentation Sections
```xml
<module name="Vendor_Module" title="My Module" sortOrder="10">
    <documentation name="Getting Started" path="Docs/GettingStarted" sortOrder="10"/>
    <documentation name="Configuration" path="Docs/Config" sortOrder="20"/>
    <documentation name="API Reference" path="Docs/Api" sortOrder="30"/>
</module>
```

### Advanced Features

#### ACL Protection

Restrict documentation visibility:

```xml
<documentation 
    name="Admin Guide" 
    path="Docs/Admin" 
    acl="Vendor_Module::admin_documentation"/>
```

Define the ACL resource in `etc/acl.xml`:

```xml
<acl>
    <resources>
        <resource id="Magento_Backend::admin">
            <resource id="Vendor_Module::admin_documentation" title="Admin Documentation"/>
        </resource>
    </resources>
</acl>
```

#### Custom Module Icons

Add visual branding with custom icons:

```xml
<module name="Vendor_Module" icon="Vendor_Module::images/module-icon.svg">
    <documentation name="Guide" path="Docs"/>
</module>
```

Place your SVG icon at: `view/adminhtml/web/images/module-icon.svg`

#### File Naming Convention

Use numeric prefixes for ordered navigation:

```
Docs/
├── 1-introduction.md       (appears first)
├── 2-installation.md       (appears second)
├── 3-configuration.md      (appears third)
└── advanced/
    ├── 1-api.md
    └── 2-troubleshooting.md
```

### Markdown Support

The module uses [CommonMark](https://commonmark.org/) with GitHub Flavored Markdown extensions.

#### Supported Features

- **Headers** (`#`, `##`, `###`, etc.)
- **Bold** (`**text**`) and *Italic* (`*text*`)
- **Lists** (ordered and unordered)
- **Links** (`[text](url)`)
- **Images** (`![alt](url)`)
- **Code blocks** (with syntax highlighting)
- **Tables**
- **Blockquotes** (`>`)
- **Horizontal rules** (`---`)
- **Task lists** (`- [ ]` / `- [x]`)
- **Strikethrough** (`~~text~~`)

#### Example Markdown

```markdown
## Getting Started

### Installation

Follow these steps:

1. Install the module
2. Enable it
3. Clear cache

### Code Example

```php
$documentation = $this->documentationProvider->getDocumentation('Vendor_Module');
```

### Important Note

> Always clear cache after modifying documentation.xml
```

### API

#### DocumentationProviderInterface

```php
<?php

namespace Magebit\Documentation\Api;

interface DocumentationProviderInterface
{
    /**
     * Get all registered documentation
     *
     * @return array
     */
    public function getDocumentation(): array;

    /**
     * Get documentation for specific module
     *
     * @param string $moduleName
     * @return array|null
     */
    public function getModuleDocumentation(string $moduleName): ?array;
}
```

#### SearchServiceInterface

```php
<?php

namespace Magebit\Documentation\Api;

interface SearchServiceInterface
{
    /**
     * Search documentation
     *
     * @param string $query
     * @return \Magebit\Documentation\Api\Data\SearchResultInterface
     */
    public function search(string $query): SearchResultInterface;
}
```

### Permissions

Grant access to documentation in **System → Permissions → User Roles**:

- **View Documentation**: `Magebit_Documentation::view`

### Troubleshooting

#### Documentation Not Appearing

1. Check that `etc/documentation.xml` is valid
2. Clear cache: `bin/magento cache:flush`
3. Verify the module is enabled: `bin/magento module:status Magebit_Documentation`
4. Check file permissions on `Docs/` folder

#### Icons Not Displaying

1. Verify icon path in `documentation.xml`
2. Check that SVG file exists at the specified location
3. Clear static content: `bin/magento setup:static-content:deploy`

## Recent Versions

| Version | Released |
|---|---|
| v0.0.1 | 2026-02-10 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| league/commonmark | ^2.0 |
| magento/framework | * |
| php | ^8.1 |

## Quality

Latest release (v0.0.1) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 23 | 23 warnings (ruleset: Magento2) |
| PHPMD | Warning | 5 | 5 rule violations (CyclomaticComplexity:2, NPathComplexity:2, ExcessiveClassComplexity:1) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 5 | 5 | – | – |
| 2.4.8 | – | 5 | 5 | – |
| 2.4.9 | – | – | 5 | 5 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["magebitcom/module-documentation"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

magebitcom is a Magento 2 vendor on Packagento. See https://packagento.com/magebitcom.md for their full catalogue.

