PHPackages                             cube-agency/filament-template - 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. [Templating &amp; Views](/categories/templating)
4. /
5. cube-agency/filament-template

ActiveLibrary[Templating &amp; Views](/categories/templating)

cube-agency/filament-template
=============================

Template field for Filament

v3.0.0(1w ago)11.3k↓77.2%1MITPHPPHP ^8.2

Since Jan 3Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/cube-agency/filament-template)[ Packagist](https://packagist.org/packages/cube-agency/filament-template)[ Docs](https://github.com/cube-agency/filament-template)[ RSS](/packages/cube-agency-filament-template/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (6)Dependencies (18)Versions (11)Used By (1)

Template field for Filament
===========================

[](#template-field-for-filament)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9e8dd638abf02e342907c8dff461ee741f015223aa8bf0b3adfe1f11eb5734b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f637562652d6167656e63792f66696c616d656e742d74656d706c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cube-agency/filament-template)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c7e45c5a88c2c69f7aeeb9c3e941dcadfdf334809da649a413a9803afdd76ad9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f637562652d6167656e63792f66696c616d656e742d74656d706c6174652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/cube-agency/filament-template/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/6229008bb953166fb1e8a294115a025411158859378d2eac713c83e35b4325ab/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f637562652d6167656e63792f66696c616d656e742d74656d706c6174652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/cube-agency/filament-template/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/0c698c540f11afb55d96be5b92635cf4313fc10fee6145196c853403d3879845/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f637562652d6167656e63792f66696c616d656e742d74656d706c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cube-agency/filament-template)

Template field for Filament, that gives an option to have different fields based on field value or type in one Resource.

Compatibility
-------------

[](#compatibility)

Package VersionFilament Version1.x3.x2.x4.x3.x5.xInstallation
------------

[](#installation)

You can install the package via composer:

```
composer require cube-agency/filament-template
```

You can publish the config file with:

```
php artisan vendor:publish --tag="filament-template-config"
```

Usage
-----

[](#usage)

Add "template" column to your Model/table

```
$table->string('template');
```

Create your template by using console command:

```
php artisan filament-template:create Blog
```

Add it to config

```
return [
    'templates' => [
        \App\Filament\Templates\BlogTemplate::class,
    ]
];
```

At this moment, this could be used by passing url parameter (query string) to create form

```
class CreatePage extends CreateRecord
{
    public $template;

    protected $queryString = ['template'];
}
```

and adding this in your Resource

```
public static function form(Schema $schema): Schema
{
    return $schema
        ->components([
            // ...
            Hidden::make('template')
                ->default($this->getTemplate()),
            Template::make('content')
                ->template($this->resolveTemplate()),
        ]);
}

protected function resolveTemplate()
{
    return app($this->getTemplate());
}

protected function getTemplate()
{
    if (property_exists($this, 'template')) {
         return $this->template;
    }

    return $this->getRecord()->getAttribute('template');
}
```

Override create action to show modal with template select

```
public function getActions(): array
{
    return [
        Action::make('create')
            ->form($this->actionForm())
            ->action(function (array $data): void {
                $parameters = http_build_query($data);

                $this->redirect(static::$resource::getUrl('create') . '?' . $parameters);
            })
    ];
}

protected function getTemplates(): Collection
{
    return collect(config('filament-template.templates'))->mapWithKeys(function ($template) {
        $templateName = explode('\\', $template);
        return [$template => end($templateName)];
    });
}

protected function actionForm(): array
{
    return [
        Select::make('template')
            ->label('Template')
            ->options($this->getTemplates())
            ->required(),
    ];
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Dmitrijs Mihailovs](https://github.com/dmitrijs.mihailovs)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance88

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~150 days

Recently: every ~190 days

Total

7

Last Release

9d ago

Major Versions

v1.0.3 → v2.0.02025-10-06

v2.0.0 → v3.0.02026-06-25

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.0.1PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/686243?v=4)[Miks Miķelsons](/maintainers/miks)[@miks](https://github.com/miks)

---

Top Contributors

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

---

Tags

laravelcube-agencyfilament-template

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/cube-agency-filament-template/health.svg)

```
[![Health](https://phpackages.com/badges/cube-agency-filament-template/health.svg)](https://phpackages.com/packages/cube-agency-filament-template)
```

###  Alternatives

[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[relaticle/flowforge

Flowforge is a lightweight Kanban board package for Filament that works with existing Eloquent models.

413106.5k5](/packages/relaticle-flowforge)[awcodes/richer-editor

A collection of extensions and tools to enhance the Filament Rich Editor field.

3912.9k9](/packages/awcodes-richer-editor)[danihidayatx/image-optimizer

Optimize your Filament images before they reach your database. Forked from joshembling/image-optimizer for Filament v4 &amp; v5 support.

3218.1k](/packages/danihidayatx-image-optimizer)[codewithdennis/filament-advanced-choice

Beautiful, customizable radio and checkbox form layouts for FilamentPHP.

1016.5k3](/packages/codewithdennis-filament-advanced-choice)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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