PHPackages                             presprog/kirby-auto-file-templates - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. presprog/kirby-auto-file-templates

ActiveKirby-plugin[Utility &amp; Helpers](/categories/utility)

presprog/kirby-auto-file-templates
==================================

Automatically assign file templates on upload based on the file type

1.0.3(6mo ago)9487↓50%1[1 issues](https://github.com/presprog/kirby-auto-file-templates/issues)1MITPHPPHP ^8.2CI failing

Since Mar 19Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/presprog/kirby-auto-file-templates)[ Packagist](https://packagist.org/packages/presprog/kirby-auto-file-templates)[ RSS](/packages/presprog-kirby-auto-file-templates/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (1)

[![Kirby Auto File Templates Plugin](/.github/banner.png)](/.github/banner.png)

Automatically assign templates to your uploaded files
=====================================================

[](#automatically-assign-templates-to-your-uploaded-files)

> ⚡ Ready for Kirby 5!

This plugin automatically assigns file templates to your uploaded files, based on the respective file type. This way it does not matter, which file type you upload from which field or section – the template assigned will always be the same. This is especially handy, when you use a single files section per page, that stores all the different file types used on the page.

Important

Requires at least Kirby 4.0 and PHP 8.2

🚀 How to use
------------

[](#-how-to-use)

Set up your configuration (see next section) first. The plugin will then run after each uploaded file (`file.create:after` hook) and assign the configured template automatically.

If you add the plugin to an existing project, you can run the `auto-templates` command from the CLI. It will iterate over every file in every page and assign the template according to the configuration:

```
$ php vendor/bin/kirby auto-templates

image.png: image
video.mp4: video

> All files updated
```

By default, existing template assignments will not be touched. To change that, run the command with `--force/-f` or set the `forceOverwrite` option globally in your `config.php` (see below).

⚙️ Config
---------

[](#️-config)

The plugin works in an opt-in manner: It does nothing except you tell it to.

```
// site/config/config.php

'presprog.auto-file-templates' => [
  // Do nothing (default)
  'autoAssign' => false,

  // OR automatically assign a file template for every file type
  'autoAssign' => true,

  // OR only assign templates to some file types (ignore file types other than `image` and `video`
  'autoAssign' => [
      'image' => true,
      'video' => true,
  ],

  // OR define a specific template for just some file types and let the plugin decide for the others
  'autoAssign' => [
      'image' => 'my-custom-image-blueprint',
      'video' => true, // => 'video'
  ],

  // OR handle more advanced use-cases in callable yourself (assign different file templates for vector and raster images)
  'autoAssign' => [
      'image' => function(\Kirby\Cms\File $file) {
          return match (F::extension($file->filename())) {
              'svg'   => 'vector',
              default => 'image',
          };
      },
  ],

  // Overwrite existing template assignments (default: false)
  'forceOverwrite' => true,
],
```

With `autoAssign = true`, each file type will get the identically named file blueprint assigned as template:

File typeFile blueprintaudiosite/blueprints/files/audioarchivesite/blueprints/files/archivecodesite/blueprints/files/codeimagesite/blueprints/files/imagevideosite/blueprints/files/videoyour-typesite/blueprints/files/your-type\* The Kirby core file types `archive`, `audio`, `document`, `image` and `video` and [your custom file type extensions](https://getkirby.com/docs/reference/plugins/extensions/file-types) are supported out-of-the-box.

💻 How to install
----------------

[](#-how-to-install)

Install this plugin via **Composer** (recommended):

```
composer require presprog/kirby-auto-file-templates
```

Or **download the ZIP file** from GitHub and unpack it to `site/plugins/kirby-auto-file-templates`

Or as **Git submodule**

```
git submodule add https://github.com/presprog/kirby-auto-file-templates.git site/plugins/auto-file-templates
```

✅ To do
-------

[](#-to-do)

- Add multi-language support

📄 License
---------

[](#-license)

MIT License Copyright © 2025 Present Progressive

---

[![](/logo.svg?raw=true)](/logo.svg?raw=true)

Made by [Present Progressive](https://www.presentprogressive.de) for the Kirby community.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance63

Regular maintenance activity

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

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

Every ~290 days

Total

3

Last Release

204d ago

Major Versions

0.1.0 → 1.0.12024-04-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb1ebdab7f2ba8b43be86588cbdcf153b0342e9364c3c890f8b8d6715fccbc3f?d=identicon)[presprog](/maintainers/presprog)

---

Top Contributors

[![bezin](https://avatars.githubusercontent.com/u/4400435?v=4)](https://github.com/bezin "bezin (68 commits)")[![caplod](https://avatars.githubusercontent.com/u/435070?v=4)](https://github.com/caplod "caplod (1 commits)")

---

Tags

kirbykirby-4kirby-5kirby-cmskirby-plugin

### Embed Badge

![Health badge](/badges/presprog-kirby-auto-file-templates/health.svg)

```
[![Health](https://phpackages.com/badges/presprog-kirby-auto-file-templates/health.svg)](https://phpackages.com/packages/presprog-kirby-auto-file-templates)
```

###  Alternatives

[distantnative/retour-for-kirby

Manage redirects and track 404s right from the Kirby CMS Panel

14689.4k1](/packages/distantnative-retour-for-kirby)[mzur/kirby-uniform

A versatile Kirby plugin to handle web form actions.

26068.3k13](/packages/mzur-kirby-uniform)[arnoson/kirby-vite

Vite helper for Kirby CMS

9759.2k3](/packages/arnoson-kirby-vite)[thathoff/kirby-git-content

Plugin to track changes to content in a git repository.

15343.7k](/packages/thathoff-kirby-git-content)[sylvainjule/locator

A map &amp; geolocation field, built on top of open-source services / Mapbox

11237.3k1](/packages/sylvainjule-locator)[tobimori/kirby-seo

The default choice for SEO on Kirby: Implement technical SEO &amp; Meta best practices with ease and provide an easy-to-use editor experience

10039.7k1](/packages/tobimori-kirby-seo)

PHPackages © 2026

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