PHPackages                             creagia/filament-code-field - 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. creagia/filament-code-field

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

creagia/filament-code-field
===========================

A Filamentphp input field to edit or view code data.

3.0.5(2mo ago)58289.3k↓15.9%14[1 PRs](https://github.com/creagia/filament-code-field/pulls)3MITPHPPHP ^8.1CI passing

Since Nov 28Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/creagia/filament-code-field)[ Packagist](https://packagist.org/packages/creagia/filament-code-field)[ Docs](https://github.com/creagia/filament-code-field)[ GitHub Sponsors](https://github.com/creagia)[ RSS](/packages/creagia-filament-code-field/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (28)Versions (23)Used By (3)

Filamentphp code field
======================

[](#filamentphp-code-field)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7d5854824065111982dcc6040a27a4c53f7db93a871791ea377af044d6a4ccdc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f637265616769612f66696c616d656e742d636f64652d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/creagia/filament-code-field)[![GitHub Tests Action Status](https://camo.githubusercontent.com/62c62287f161322a019304c8e6f8499c556bb78b30b8195df3a1f86ee1346e92/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f637265616769612f66696c616d656e742d636f64652d6669656c642f72756e2d74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/creagia/filament-code-field/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f520d579e7ce96b26273a6f8893684a7e645bf72a57808289b907e06b5ec51ad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f637265616769612f66696c616d656e742d636f64652d6669656c642f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/creagia/filament-code-field/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/682b1ee0957aaa5b1b116e14f190862f6a00d3955db6ac3f6deb54aec9eca7f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f637265616769612f66696c616d656e742d636f64652d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/creagia/filament-code-field)

A [CodeMirror](https://codemirror.net/) powered code field for the Filamentphp admin panel and form builder.

With code autocompletion, light/dark modes, multiple languages, read-only mode and more.

Check screenshots and read more about the package in our [blog post](https://creagia.com/blog/a-code-field-for-the-filamentphp-admin-panel-and-form-builder).

Installation
------------

[](#installation)

**Latest version of the package requires Filament 3 and Laravel 11.**

You can install the package via composer:

```
composer require creagia/filament-code-field
```

### ⚠️ Use version `2.x.x` for Filament 3 and Laravel 10-12 support ⚠️

[](#️-use-version-2xx-for-filament-3-and-laravel-10-12-support-️)

```
composer require "creagia/filament-code-field:^2.0.0"
```

### ⚠️ Use version `1.x.x` for Filament 2 support ⚠️

[](#️-use-version-1xx-for-filament-2-support-️)

```
composer require "creagia/filament-code-field:^1.0.0"
```

Usage
-----

[](#usage)

Creating a code field is straightforward, just instantiate the `CodeField` class for the desired property.

```
use Creagia\FilamentCodeField\CodeField;

return $form
    ->schema([
        CodeField::make('my_json'),
        // other fields
    ]);
```

### Choosing another language

[](#choosing-another-language)

By default, a JSON field will be created.

If you want to create a field for another supported language, you can do so with the `setLanguage()` and helper methods.

Supported languages: JSON, PHP, HTML, XML and JavaScript (JS).

```
use Creagia\FilamentCodeField\CodeField;

return $form
    ->schema([
        CodeField::make('js_code')
            ->setLanguage(CodeField::JS),
            // or
            ->jsField()
    ]);
```

### Disabling code completion

[](#disabling-code-completion)

By default, the field comes with code completion/suggestions enabled.

For disabling this feature, use the `disableAutocompletion()`.

```
use Creagia\FilamentCodeField\CodeField;

return $form
    ->schema([
        CodeField::make('js_code')
            ->htmlField()
            ->disableAutocompletion(),
    ]);
```

### Line numbers

[](#line-numbers)

Line numbers can be enabled using the `withLineNumbers()` method.

```
use Creagia\FilamentCodeField\CodeField;

return $form
    ->schema([
        CodeField::make('json')
            ->withLineNumbers(),
    ]);
```

### Read-only mode

[](#read-only-mode)

Adding the Filamentphp `disabled()` method will make the code field read-only.

```
use Creagia\FilamentCodeField\CodeField;

return $form
    ->schema([
        CodeField::make('json')
            ->disabled(),
    ]);
```

### Filamentphp methods

[](#filamentphp-methods)

Of course, the code field extends the `Filamentphp` field class, and you can use all the usual methods such as `label()`.

```
use Creagia\FilamentCodeField\CodeField;

return $form
    ->schema([
        CodeField::make('json')
            ->label('Your JSON data')
            ->hint('Top right corner info')
            ->helper('More info after the text field')
            // more methods
            ,
    ]);
```

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance86

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~62 days

Recently: every ~178 days

Total

20

Last Release

75d ago

Major Versions

1.0.11 → v2.x-dev2023-07-10

2.0.0 → 3.0.02024-03-21

PHP version history (3 changes)1.0.0PHP ^8.0

3.0.0PHP ^8.2

3.0.3PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![ricardcreagia](https://avatars.githubusercontent.com/u/33965585?v=4)](https://github.com/ricardcreagia "ricardcreagia (33 commits)")[![dtorras](https://avatars.githubusercontent.com/u/240932?v=4)](https://github.com/dtorras "dtorras (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")[![rtraselbd](https://avatars.githubusercontent.com/u/31556372?v=4)](https://github.com/rtraselbd "rtraselbd (1 commits)")[![wilfredchen](https://avatars.githubusercontent.com/u/46327334?v=4)](https://github.com/wilfredchen "wilfredchen (1 commits)")[![ziming](https://avatars.githubusercontent.com/u/679513?v=4)](https://github.com/ziming "ziming (1 commits)")[![gasner](https://avatars.githubusercontent.com/u/6614838?v=4)](https://github.com/gasner "gasner (1 commits)")[![JustinElst](https://avatars.githubusercontent.com/u/249633?v=4)](https://github.com/JustinElst "JustinElst (1 commits)")[![mansoorkhan96](https://avatars.githubusercontent.com/u/51432274?v=4)](https://github.com/mansoorkhan96 "mansoorkhan96 (1 commits)")

---

Tags

laravelcode editorfilamentcreagiafilament-code-fieldfilament field

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/creagia-filament-code-field/health.svg)

```
[![Health](https://phpackages.com/badges/creagia-filament-code-field/health.svg)](https://phpackages.com/packages/creagia-filament-code-field)
```

###  Alternatives

[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[swisnl/filament-backgrounds

Beautiful backgrounds for Filament auth pages

54149.2k6](/packages/swisnl-filament-backgrounds)[guava/calendar

Adds support for vkurko/calendar to Filament PHP.

298241.0k3](/packages/guava-calendar)[tapp/filament-google-autocomplete-field

Filament plugin that provides a Google Autocomplete field

3098.1k](/packages/tapp-filament-google-autocomplete-field)[jibaymcs/filament-tour

Bring the power of DriverJs to your Filament panels and start a tour !

12247.8k](/packages/jibaymcs-filament-tour)

PHPackages © 2026

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