goldfinch/json-editor
Composer 安装命令:
composer require goldfinch/json-editor
包简介
Indispensable tool to work with JSON data. Makes it easy to handle any JSON schema and adjusts the output for Silverstripe templates
关键字:
README 文档
README
Indispensable tool to work with JSON data. Makes it easy to handle any JSON schema in a user-friendly interface and adjusts the output for Silverstripe templates.
This module is using json-editor under the hood. Refer to its README to learn more about JSON Schema, all field types, properties, and available options that you can use.
Install
composer require goldfinch/json-editor
Available Taz commands
If you haven't used Taz🌪️ before, taz file must be presented in your root project folder cp vendor/goldfinch/taz/taz taz
Create schema file
php taz make:json-schema
Usage
use Goldfinch\JSONEditor\Forms\JSONEditorField; use Goldfinch\JSONEditor\ORM\FieldType\DBJSONText; private static $db = [ 'Json' => DBJSONText::class, ]; public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab( 'Root.Main', [ JSONEditorField::create('Json', 'Json', $this), ] ); return $fields; }
✳️ You can also use an extension instead.
Page:
extensions:
- Goldfinch\JSONEditor\Extensions\JsonDataExtension
Each JSON field must have a schema file. Schema files are stored within app/_schema directory.
Based on the example above, we can say that our Page.php has Json field, therefore our schema file should be named as Page-Json.json following {class_name}-{field_name}.json pattern.
Example:
1) Create schema file
Use Taz🌪️ to generate your Schema file. It will quickly lead you through the setup and take care of it for you.
php taz make:json-schema
2) Output JSON data in Silverstripe template.
At this step, we can go and add some JSON data in CMS to play with. Once we are done, we can output our pure JSON data using familiar Silverstripe syntax.
<% with $Json.Parse %> <% loop Me %> <div><strong>Enabled:</strong> <% if enabled %>yes<% else %>no<% end_if %></div> <div><strong>First name:</strong> $firstname</div> <div><strong>Last name:</strong> $lastname</div> <div><strong>Cars:</strong> <% loop cars %><% if not IsFirst %>, <% end_if %>$Me<% end_loop %></div> <div><strong>About:</strong> $about</div> <% end_loop %> <% end_with %>
License
The MIT License (MIT)
goldfinch/json-editor 适用场景与选型建议
goldfinch/json-editor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.85k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 10 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「silverstripe」 「json-editor-field」 「json-editor-field-silverstripe」 「json-field」 「json-field-silverstripe」 「json-silverstripe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 goldfinch/json-editor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 goldfinch/json-editor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 goldfinch/json-editor 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Analytics chooser extensions for site settings.
CitaNZ's SilverStripe picture object and field for SilverStripe 4
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
Allows you to defined CMS form structure via config.yml
A module for adding a podcast or multiple podcasts to your SilverStripe site. With support for audio, video or other files.
统计信息
- 总下载量: 1.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-18
