skuzalabs / filament-signature-pad
为 FilamentPHP 表单构建器提供的签名板字段
v1.0.4
2023-03-11 05:33 UTC
Requires
- php: ^8.0
- filament/filament: ^2.0
- illuminate/contracts: ^9.0 | ^10.0
- spatie/laravel-package-tools: ^1.13.5
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- pestphp/pest-plugin-livewire: ^1.0
- pestphp/pest-plugin-parallel: ^1.2
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
README
A Signature Pad Field for the FilamentPHP Form Builder using szimek/signature_pad
安装
您可以通过 composer 安装此包
composer require skuzalabs/filament-signature-pad
用法
现在您可以在表单构建器中使用 SignaturePad 字段。
use Skuzalabs\SignaturePad\Forms\Components\Fields\SignaturePad; public static function form(Form $form): Form { return $form ->schema([ // ... Other fields SignaturePad::make('signature'), // Chain your field modifiers here // Other fields ]); }
您还可以设置如下所示的签名板选项。有关更多详细信息,请参阅 SignaturePad 选项文档。
use Skuzalabs\SignaturePad\Forms\Components\Fields\SignaturePad; public static function form(Form $form): Form { return $form ->schema([ // ... Other fields SignaturePad::make('signature') ->strokeMinWidth(1.0) ->strokeMaxWidth(2.5) ->strokeDotSize(2.0) ->penColor('rgb(0,0,255)') // Blue ->backgroundColor('rgba(0,0,0,0)'), // Black Transparent // Other fields ]); }
在保存时,签名图像作为 png 数据 URL 保存到数据库中。目前正在计划支持将签名作为图像 blob 文件上传到服务器。
测试
composer test
致谢
许可协议
MIT 许可协议 (MIT)。请参阅 许可文件 了解更多信息。