- What Laravel versions does Sharp support, and is it compatible with PHP 8.2?
- Sharp requires **Laravel 11+** and **PHP 8.3+** due to its reliance on modern Laravel features like Enums, Attributes, and Fiber-based HTTP. PHP 8.2 is not supported, as Sharp leverages newer PHP syntax and optimizations. Always check the [Sharp documentation](http://sharp.code16.fr/docs) for the latest compatibility notes before upgrading.
- Can I use Sharp with existing Eloquent models, or do I need to create new ones?
- Sharp is **data-agnostic** and works with existing Eloquent models out of the box. You can define content models as PHP classes (e.g., `PostEntity`) that mirror or extend your Eloquent models, reducing boilerplate. This makes it easy to integrate with your existing database schema without duplication.
- How does Sharp handle authorization? Does it work with Laravel’s gates/policies?
- Sharp integrates seamlessly with Laravel’s **gates, policies, and middleware** for authorization. You can apply existing auth logic to CMS actions (e.g., `create`, `update`, `delete`) without rewriting rules. It also supports role-based access control (RBAC) via Laravel’s built-in systems like Sanctum or Passport.
- Is Sharp suitable for headless CMS use cases, or does it require a frontend?
- Sharp is **frontend-agnostic** and works perfectly for headless CMS scenarios. Since it’s API-driven (PHP-only), you can manage content via its RESTful endpoints or GraphQL (if integrated) without needing the Inertia.js admin panel. The UI is optional and only required for manual content management.
- How does Sharp compare to Filament or Nova for Laravel admin panels?
- Sharp differs from Filament/Nova by focusing on **structured data management** (e.g., blog posts, products) rather than full-fledged admin dashboards. It’s **code-driven, data-agnostic, and requires no frontend code**, while Filament/Nova are more opinionated with Blade/Inertia-based UIs. Sharp is ideal if you need a lightweight, API-first CMS layer.
- Can I customize Sharp’s UI beyond the default Inertia.js components?
- Sharp provides **default React/Vue components** via Inertia.js, but deep UI customization requires overriding or extending its core components. While the package prioritizes convention (e.g., form layouts, tables), you can replace individual parts like buttons, modals, or icons. For radical changes, you may need to fork or rebuild components.
- Does Sharp support multi-tenancy or workflow approvals (e.g., draft/publish)?
- Sharp supports **multi-tenancy** via Laravel’s built-in features (e.g., middleware, query scopes) and can implement workflows like draft/publish using **custom commands or entity lifecycle hooks**. For approvals, you’d typically extend Sharp’s validation or authorization logic with Laravel’s gates/policies or a package like `spatie/laravel-activitylog`.
- How do I migrate from Sharp v8 to v9? Are there breaking changes?
- Migrating from Sharp v8 to v9 involves **breaking changes**, including updates to the config builder, middleware system, and icon handling. The [Sharp documentation](http://sharp.code16.fr/docs) outlines a migration guide, but plan for a dedicated phase to test changes in a staging environment. Key areas to review: entity definitions, Inertia.js props, and custom middleware.
- Can Sharp work with non-Eloquent data sources (e.g., APIs, NoSQL)?
- Yes, Sharp is **data-agnostic** and can work with any structured data source. While it’s optimized for Eloquent, you can adapt it to APIs (e.g., via Laravel’s HTTP clients) or NoSQL (e.g., MongoDB with a custom repository) by implementing Sharp’s `Entity` interface. This requires wrapping your data in a Sharp-compatible class.
- What’s the performance impact of using Sharp with Inertia.js in production?
- Sharp’s Inertia.js integration adds minimal overhead for CRUD operations, but **large datasets or complex queries** may benefit from caching. You can cache entity lists, search results, or filtered collections using Laravel’s cache drivers. For high-traffic CMS sections, optimize queries with Eloquent scopes or database indexing.