- How do I install webkenth/filament-code-field in a Laravel app?
- Install the package with Composer using composer require webkenth/filament-code-field. Then add the package's code field class to a Filament form schema in your resource or custom form. Check the repository README for any asset publishing or registration steps required by your Filament version.
- Which Laravel and Filament versions does this code field support?
- Version support is defined by the package's composer.json constraints, so check those before installing. It is a Filament form field, so your app must run a compatible Filament major version and a Laravel version that satisfies the same constraints. If you are on an older Filament release, verify compatibility in the repository before adding it to production.
- What is the difference between this package and Creagia's Code Field?
- This package is a copy of Creagia's Code Field with cleaned-up developer dependencies, intended to avoid Composer conflicts caused by the original package's dev requirements. The goal is the same form-field experience for editing code inside Filament forms and resources. Use this fork when the original package's dependency setup causes problems in your project.
- How do I add a syntax-highlighted code editor to a Filament resource form?
- Add the package's code field class to the form schema in your Filament resource or custom Livewire form, using the database column name as the field name. You can typically chain configuration methods such as language or theme before saving the schema. The field then renders an in-browser code editor instead of a plain textarea.
- Can I use this field to edit JSON, YAML, or config files?
- Yes. It is a general-purpose code editor field, so you can use it for JSON, YAML, configuration snippets, SQL, or other plain text stored in a database column. Set the editor language to match the content where the package exposes a language option. The value is saved as normal text, so your application remains responsible for validating and parsing it.
- Do I need to publish or build JavaScript assets for this Filament field?
- Filament packages usually register their frontend assets through the service provider, but some setups require publishing assets or running a build step. Follow the installation instructions in the repository README for your Filament version. In production, make sure the compiled assets are deployed and cached as part of your normal Laravel deployment process.
- Can I customize the editor language, theme, or height?
- The field is intended to be configured from your Filament form schema, so check the README for the exact chainable methods supported by this fork. Common options for code editor fields include language mode, visual theme, and editor height. If a method you need is missing, you can extend the field class in your own application.
- Is webkenth/filament-code-field safe to use in production?
- It is a small fork of an existing Filament field, so review the repository's commit history, open issues, and Composer constraints before relying on it in production. Because the editor runs in the browser, ensure your deployment includes the required frontend assets. Pin a specific version in composer.json and test form saving and validation in your own application.
- How do I test Filament forms that use this code field?
- The field is a standard Filament form component, so you can test it through Filament's Livewire form testing helpers such as fillForm and assertFormSet. Set a plain string value for the field in your test and assert that it is saved to the model. Keep browser-level tests separate if you need to verify the JavaScript editor behavior itself.
- What alternatives exist if this package does not fit my Filament project?
- The original Creagia Code Field is the closest alternative if its dependencies work in your project. You can also use a plain Filament Textarea or TextInput for simpler cases, or build a custom field around your preferred JavaScript editor. Evaluate maintenance activity, Filament version support, and asset handling before choosing an alternative.