PHPackages                             considbrs-webdev/modularity-folder-browser - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. considbrs-webdev/modularity-folder-browser

ActiveWordpress-plugin[File &amp; Storage](/categories/file-storage)

considbrs-webdev/modularity-folder-browser
==========================================

An accessible file and folder browser module for Modularity.

02↑2900%PHP

Since Jun 7Pushed 2d agoCompare

[ Source](https://github.com/Considbrs-Webdev/modularity-folder-browser)[ Packagist](https://packagist.org/packages/considbrs-webdev/modularity-folder-browser)[ RSS](/packages/considbrs-webdev-modularity-folder-browser/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Modularity Folder Browser
=========================

[](#modularity-folder-browser)

An accessible Modularity module for exposing selected server folders as a public document browser. Editors choose one or more folders from configured safe filesystem sources, visitors can browse nested folders, and allowed files can be downloaded without exposing real filesystem paths.

Features
--------

[](#features)

- Select one or more start folders from configured filesystem sources
- Optional top folder name to group selected folders on the frontend
- Modal folder picker with lazy-loaded expandable folder trees and checkbox selection
- Accessible disclosure/list interface using real buttons and links
- Lazy-loaded subfolders through WordPress REST endpoints
- Public download endpoint with server-side path and extension validation
- Optional file type, file description, file size, and modified date display
- Natural sorting by name, date, or file type
- Hidden files, traversal attempts, and unsafe file extensions are blocked
- Source paths stay in code and are never rendered in HTML or JSON
- Default file support includes common office documents, text files, images, archives, video, and audio

Configuration
-------------

[](#configuration)

Sources must be configured by code. Use either the `MODULARITY_FILE_BROWSER_SOURCES` constant or the `modularity_file_browser_sources` filter.

```
define('MODULARITY_FILE_BROWSER_SOURCES', [
    'public-documents' => [
        'label' => 'Public documents',
        'path'  => '/srv/shared/public-documents',
    ],
]);
```

Each source path must be absolute, readable by the web server user, and resolvable with `realpath()`. Invalid sources are ignored.

Module Fields
-------------

[](#module-fields)

- Top folder name
- Start folders
- Source
- Selected folders
- Initially expanded
- Show file type
- Show file description
- Show file size
- Show modified date
- Download display
- Sort order
- Allowed file types override

Selected folders are stored only as relative paths inside the selected source. The admin folder picker uses an authenticated REST endpoint and never shows absolute paths.

The allowed file types override field can only narrow the globally allowed extensions. Use the `Modularity/Module/FolderBrowser/AllowedFileTypes` filter to change the global list.

REST Endpoints
--------------

[](#rest-endpoints)

- `GET /wp-json/modularity-file-browser/v1/admin/folders?source=public-documents&path=policies`
- `GET /wp-json/modularity-file-browser/v1/modules/{module_id}/roots/{root_index}/tree?path=optional/subfolder`
- `GET /wp-json/modularity-file-browser/v1/download?module_id=123&root=0&path=file.pdf`

The admin endpoint requires `edit_posts`. Public tree and download endpoints revalidate the stored module configuration, selected root, requested relative path, and file extension on every request.

Filters
-------

[](#filters)

### `modularity_file_browser_sources`

[](#modularity_file_browser_sources)

Add or change available filesystem sources.

```
add_filter('modularity_file_browser_sources', function (array $sources): array {
    $sources['meeting-documents'] = [
        'label' => 'Meeting documents',
        'path'  => '/srv/shared/meeting-documents',
    ];

    return $sources;
});
```

### `Modularity/Module/FolderBrowser/AllowedFileTypes`

[](#modularitymodulefolderbrowserallowedfiletypes)

Restrict or extend the global file extension allowlist. The filter receives the plugin defaults and the current module ID, so it can be used to add file types, remove file types, or replace the whole list. Server-side executable extensions remain blocked even if they are added here.

```
add_filter('Modularity/Module/FolderBrowser/AllowedFileTypes', function (array $extensions): array {
    $extensions[] = 'heic';

    return array_values(array_unique($extensions));
});
```

```
add_filter('Modularity/Module/FolderBrowser/AllowedFileTypes', function (array $extensions): array {
    return array_values(array_diff($extensions, ['zip', 'rar', '7z', 'tar', 'gz']));
});
```

```
add_filter('Modularity/Module/FolderBrowser/AllowedFileTypes', function (array $extensions, ?int $moduleId): array {
    if ($moduleId === 123) {
        return ['pdf', 'docx', 'xlsx'];
    }

    return $extensions;
}, 10, 2);
```

Default allowed extensions:

```
pdf, doc, docx, odt, rtf, xls, xlsx, ods, ppt, pptx, odp, txt, md, csv,
jpg, jpeg, png, gif, webp,
zip, rar, gz, 7z, tar,
mp4, m4v, mov, avi, webm, mkv, wmv, mpeg, mpg, 3gp, ogv,
mp3, wav, ogg, oga, m4a, aac, flac, wma, aiff, aif, opus
```

### `modularity_file_browser_file_icon`

[](#modularity_file_browser_file_icon)

Override the icon URL for a file extension or icon category.

```
add_filter('modularity_file_browser_file_icon', function (string $url, string $extension, string $category): string {
    if ($category === 'archive') {
        return get_stylesheet_directory_uri() . '/assets/icons/archive.svg';
    }

    return $url;
}, 10, 3);
```

### `modularity_file_browser_folder_icon`

[](#modularity_file_browser_folder_icon)

Override the folder icon URL.

```
add_filter('modularity_file_browser_folder_icon', function (string $url): string {
    return get_stylesheet_directory_uri() . '/assets/icons/folder.svg';
});
```

### `modularity_file_browser_cache_ttl`

[](#modularity_file_browser_cache_ttl)

Change directory listing cache duration.

```
add_filter('modularity_file_browser_cache_ttl', function (): int {
    return 5 * MINUTE_IN_SECONDS;
});
```

Development
-----------

[](#development)

```
composer install
npm install
npm run build
```

Requirements
------------

[](#requirements)

- WordPress
- Modularity
- Advanced Custom Fields Pro
- Municipio/component library for Blade rendering

License
-------

[](#license)

MIT

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance65

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18331514?v=4)[Michael Claesson](/maintainers/michaelclaesson)[@michaelclaesson](https://github.com/michaelclaesson)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/considbrs-webdev-modularity-folder-browser/health.svg)

```
[![Health](https://phpackages.com/badges/considbrs-webdev-modularity-folder-browser/health.svg)](https://phpackages.com/packages/considbrs-webdev-modularity-folder-browser)
```

###  Alternatives

[glicer/sync-sftp

Sync local files with ftp server

212.7k](/packages/glicer-sync-sftp)[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.7k](/packages/venveo-craft-compress)

PHPackages © 2026

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