creagia/filament-code-field
Composer 安装命令:
composer require creagia/filament-code-field
包简介
A Filamentphp input field to edit or view code data.
README 文档
README
A CodeMirror 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.
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 ⚠️
composer require "creagia/filament-code-field:^2.0.0"
⚠️ Use version 1.x.x for Filament 2 support ⚠️
composer require "creagia/filament-code-field:^1.0.0"
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
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
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 can be enabled using the withLineNumbers() method.
use Creagia\FilamentCodeField\CodeField; return $form ->schema([ CodeField::make('json') ->withLineNumbers(), ]);
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
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 , ]);
creagia/filament-code-field 适用场景与选型建议
creagia/filament-code-field 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 305.41k 次下载、GitHub Stars 达 57, 最近一次更新时间为 2022 年 11 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「code editor」 「filament」 「creagia」 「filament-code-field」 「filament field」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 creagia/filament-code-field 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 creagia/filament-code-field 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 creagia/filament-code-field 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Adds more BBCode
Promotional Codes Generator for Laravel 5.1
UEditor 是一套开源的在线HTML编辑器,主要用于让用户在网站上获得所见即所得编辑效果,开发人员可以用 UEditor 把传统的多行文本输入框(textarea)替换为可视化的富文本输入框。
Zend Captcha bundle
Simple WYSIWYG editor plugin for Bootstrap 3
统计信息
- 总下载量: 305.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 57
- 点击次数: 23
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-28