PHPackages                             buzzingpixel/filecontent - 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. buzzingpixel/filecontent

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

buzzingpixel/filecontent
========================

Add flat file content capability to your CraftCMS site

1.0.0(8y ago)111PHPPHP &gt;=7.0.0

Since Oct 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/buzzingpixel/craft-filecontent)[ Packagist](https://packagist.org/packages/buzzingpixel/filecontent)[ RSS](/packages/buzzingpixel-filecontent/feed)WikiDiscussions master Synced 3d ago

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

Craft File Content
==================

[](#craft-file-content)

Add flat file content capability to your CraftCMS site
------------------------------------------------------

[](#add-flat-file-content-capability-to-your-craftcms-site)

A Craft 3 plugin that adds Twig variables for getting flat file content.

Installing
----------

[](#installing)

`composer require buzzingpixel/filecontent`

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

[](#configuration)

There is one globally configurable option: `basePath`. This tells the plugin where to look for file content. By default, it looks in `CRAFT_BASE_PATH . '/fileContent'`.

Usage
-----

[](#usage)

### `load`

[](#load)

Example:

```
{% set pageContent = craft.filecontent.load('my/custom/path') %}
```

If `my/custom/path` is a directory, the directory will be searched recursively for `.md` files, `.json` files, and `.php` files. Each of those files parsed contents will be added to an array with the filename as the key.

If `my/custom/path.md` exists, the contents of that file will be parsed and returned.

If `my/custom/path.json` exists, the contents of that file will be parsed and returned.

If `my/custom/path.php` exists, the contents of that file will be parsed and returned.

Markdown files are parsed through a Yaml front matter parser. The content portion of the markdown file is placed in a array key called 'content'.

JSON files are parsed as expected.

PHP files must return an array.

### `loadListings`

[](#loadlistings)

Example:

```
{% set blogIndex = craft.filecontent.loadListings('my/custom/path', {
    offset: 10,
    limit: 10,
    sort: 'asc'
}) %}
```

All files in the specified directory are loaded and returned. The file name format is as follows: `2015-10-26--04-00-pm--my-post-slug.md`.

`.json` and `.php` are also accepted.

If `index.md`, `index.json`, and `index.php` is found in the directory, it's contents will be added on the key `meta` and does not factor in to count, limit, and offset.

### `loadListingBySlug`

[](#loadlistingbyslug)

Example:

```
{% set blogPost = craft.filecontent.loadListingBySlug('my/custom/path', 'my-slug') %}
```

Get's a file post content by slug.

### `readFileContents`

[](#readfilecontents)

Example:

```
{% set criticalCss = craft.filecontent.readFileContents(cricitalCssPath)|raw %}
```

Reads any file's raw text content. As this is not related to the flat file content functionality, it does not look in the configured basepath, but instead defaults to `$_SERVER['DOCUMENT_ROOT']`. You can optionally specify a second parameter as the base path.

License
-------

[](#license)

Copyright 2017 BuzzingPixel, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at .

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

3124d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3749c595e494c26b1d9772c64f126c2f64f0d5057736dc5986d2f305432896ba?d=identicon)[buzzingpixel](/maintainers/buzzingpixel)

---

Top Contributors

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

---

Tags

cmsCraftcraftcmscraft-pluginfilecontent

### Embed Badge

![Health badge](/badges/buzzingpixel-filecontent/health.svg)

```
[![Health](https://phpackages.com/badges/buzzingpixel-filecontent/health.svg)](https://phpackages.com/packages/buzzingpixel-filecontent)
```

###  Alternatives

[servd/craft-remote-assets

Move CP assets to an external filesystem such as S3

1215.8k](/packages/servd-craft-remote-assets)[weareferal/remote-backup

Backup your database and assets to a remote location

115.5k](/packages/weareferal-remote-backup)[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.6k](/packages/venveo-craft-compress)[markdrzy/importable

Add CSV data import functionality to the native Table fieldtype.

114.6k2](/packages/markdrzy-importable)

PHPackages © 2026

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