customberg/customberg-php is a Laravel package.
It currently has 20 GitHub stars and 146 downloads on Packagist (latest version 0.18).
Install it with composer require customberg/customberg-php.
Discover more Laravel packages by customberg
or browse all Laravel packages to compare alternatives.
Last updated
Demo GIF
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"
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::');
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.
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
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 !
| | | | -------- | ----------------- | | ✅ | A checkbox field | | ✅ | A custom js field | | ☐ | Switch field | | ☐ | Radio field | | ☐ | Slider field | | ☐ | Google Maps field | | ☐ | Documentation ! | | ☐ | Icon picker field |
custom for custom js field with React.createElementcheckbox, textarea, number, email, urlplaceholder for text fieldshint and hint_html for all fields that show a small helper textupload_image.
'allowed_types' => ['png', 'jpg', 'webp', 'svg'],upload_file for files without preview.
'multiple' => true, if you want multiple files in the same field.text and rich_text, and works inside repeatable field.text, rich_text, color, upload_image