code16/sharp
Code-driven CMS framework for Laravel (PHP 8.3+/Laravel 11+). Build admin/CMS sections with a clean UI and strong DX: CRUD with validation, search/sort/filter, bulk or custom commands, and authorization—no front-end code required, data-agnostic.
This version brings more breaking changes than the previous ones, since we decided to clean up old code parts and to fully embrace PHP 7.x type hinting.
It's not a BC, but still, minimal requirements are now these.
In order to reinforce the API, we decided to use PHP type hinting everywhere (well, almost everywhere). This means that you'll have to add parameters and return types on EntityLists, Forms, Shows, Filters, Commands, EntityStates...
Not sure it's really a BC, unless you use direct links to a Sharp EntityList, Show, or Form in a notification for instance. Anyways all URLs changed as a consequence of the new breadcrumb feature.
LinkToEntity must be replaced by LinkTo[XXX] classesThe 5.0 LinkToEntity class has been removed in favor of:
SharpWidget::setLink() changed its parametersThis method is now expecting a LinkTo[XXX] instance.
SharpPanelWidget::make("activeSpaceships")
->setInlineTemplate("<h1>{{count}}</h1> spaceships in activity")
->setLink(LinkToEntityList::make("spaceship"));
SharpOrderedListWidget::buildItemLink() changed its parametersIn order to use the new LinkTo[XXX] classes, the Closure is now expected to either return a string (URL) or a LinkTo[XXX] instance.
SharpOrderedListWidget::make("widget")
->buildItemLink(function($item) {
return LinkToEntityList::make("entity")->addFilter("type", $item['id']);
});
SharpContext was removed in favor of CurrentSharpRequestThe Code16\Sharp\Http\Context\SharpContext class and the Code16\Sharp\Http\WithSharpContext trait were removed. If you need to know the current context, use the new Code16\Sharp\Http\Context\CurrentSharpRequest class, documented here.
EntityListFilter, EntityListMultipleFilter, EntityListRequiredFilter, DashboardFilter, DashboardRequiredFilter, DashboardMultipleFilter, which were deprecated in 5.x, were removed (and replaced by EntityLostSelectFilter, EntityListSelectMultipleFilter, EntityListSelectRequiredFilter ...).
SharpUploadModelAttributeTransformer class was removedI was used to EntityList as an attribute transformer in EntityList, for SharpUploadModel. In 6.x, you should used in replacement:
->setCustomTransformer("picture", (new SharpUploadModelThumbnailUrlTransformer(100))->renderAsImageTag())
sharp_markdown_thumbnails() helper is now deprecatedReplaced by sharp_markdown_embedded_files(), to take benefit of the feature of file embeds in the Markdown field (see documentation).
EntityState color const are deprecatedPRIMARY_COLOR, SECONDARY_COLOR, ... are deprecated.
For the primary color, use the new config config('sharp.theme.primary_color').
For other legacy colors, replace with the following hex code:
| Const | Color Hex |
|---|---|
| PRIMARY_COLOR | "#5596E6" |
| SECONDARY_COLOR | "#FD7400" |
| GRAY_COLOR | "#8C9BA5" |
| LIGHTGRAY_COLOR | "#EFF2F5" |
| DARKGRAY_COLOR | "#394B54" |
How can I help you explore Laravel packages today?