customberg/customberg-php
Composer 安装命令:
composer require customberg/customberg-php
包简介
README 文档
README
Demo GIF
Instalation
composer require customberg/customberg-php
Add vendor files to your project (CSS, JS, Config, Views):
php artisan vendor:publish --provider="VanOns\Laraberg\LarabergServiceProvider" php artisan vendor:publish --provider="Customberg\PHP\CustombergServiceProvider"
Model Setup
The model that you want to use this block editor should have:
use VanOns\Laraberg\Traits\RendersContent; class Page extends Model { use RendersContent; }
In the backpack crud controller you must create the crud field like this:
CRUD::field('content') ->label('Page content') ->type('customberg') ->view_namespace('customberg::');
Usage
Create a new block with the make:block command:
php artisan make:block AwesomeBlock
Then edit the block field definition in app/Blocks/AwesomeBlock.php file, and the block view in resources/views/blocks/cb-awesome-block.blade.php.
Checkout /example/app/Blocks/EverySingleField.php for a full example with every field type.
Update
After an update, get the latest assets using:
# update source composer require customberg/customberg-php # update public assets php artisan vendor:publish --tag="customberg-assets" --force php artisan vendor:publish --provider="VanOns\Laraberg\LarabergServiceProvider" --tag="public" --force
Example project
git clone https://github.com/customberg/customberg-php cd customberg-php/example docker compose up -d docker compose exec php su app -c 'cd example; composer install' docker compose exec php su app -c 'cd example; cp .env.example .env; php artisan key:generate' docker compose exec nginx su app -c 'cd /app/example/public/; ln -s ../storage/app/public storage'
Navigate to http://localhost:8084 and press login.
Enjoy !
Roadmap:
| ✅ | A checkbox field |
| ✅ | A custom js field |
| ☐ | Switch field |
| ☐ | Radio field |
| ☐ | Slider field |
| ☐ | Google Maps field |
| ☐ | Documentation ! |
| ☐ | Icon picker field |
Changelog:
v0.17 - 2024-10-15
- Replace str_replace_limit implementation because there is a character limit error
v0.16 - 2024-10-14
- New field type:
customfor custom js field with React.createElement - Checkout /example/app/Blocks/CustomField.php for an example with summernote for Backpack V5 (TODO: update to V6)
v0.15 - 2024-09-26
- New field types:
checkbox,textarea,number,email,url - New property
placeholderfor text fields - New property
hintandhint_htmlfor all fields that show a small helper text - Checkout /example/app/Blocks/EverySingleField.php for a full example
v0.14 - 2024-08-07
- Bugfix: Preview API while rendering a block with multilanguage, when i'm selecting the new language that does not have translation saved.
v0.13 - 2024-07-08
- Allow laravel 11 installation
v0.12 - 2023-11-09
- Bugfix error cannot redeclare str_replace_limit
v0.11 - 2023-11-08
- Update requirements to laravel 10
v0.10 - 2023-04-02
- Added file extension validation to
upload_image.
Use'allowed_types' => ['png', 'jpg', 'webp', 'svg'], - Added
upload_filefor files without preview.
Use'multiple' => true,if you want multiple files in the same field.
v0.9 - 2023-01-01
- Multilanguage fine tuning, made configurable language list and bugfixing
- Multilanguage only supports fields
textandrich_text, and works inside repeatable field.
v0.8 - 2022-12-31
- Fine tuning for repeatable field frontend
- Added buttons to move and duplicate a item inside repeatable
- Added example block for repeatable
v0.7 - 2022-12-30
- First version published to packagist.org ! 🎉🥳
- Only available fields are:
text, rich_text, color, upload_image - Repeatable is present but untested. Multilanguage present but untested and hardcoded.
customberg/customberg-php 适用场景与选型建议
customberg/customberg-php 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 146 次下载、GitHub Stars 达 20, 最近一次更新时间为 2022 年 12 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「gutenberg」 「block-editor」 「laraberg」 「customberg」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 customberg/customberg-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 customberg/customberg-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 customberg/customberg-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Create Gutenberg blocks from Twig templates and ACF fields.
Loads and caches blocks with View capabilities
A collection of blocks we use at eighteen73.
Batch migration from classic editor content to Gutenberg blocks.
A customizable services section block with SVG icon support for WordPress Gutenberg editor
Alfabank REST API integration
统计信息
- 总下载量: 146
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-30
