- How do I install goldnead/statamic-entitlements in a Laravel app?
- Install it with Composer using composer require goldnead/statamic-entitlements. Then complete the addon's Statamic setup steps, such as publishing any provided config, before defining entitlements. Because it is a Statamic addon, it should be added to a Laravel application that already runs Statamic.
- Which Laravel and Statamic versions does goldnead/statamic-entitlements support?
- Compatibility is determined by the Statamic and Laravel version constraints in the package's composer.json. Check those requirements on Packagist or in the repository before installing, and match them to your app's Statamic version. If you are on an older Laravel release, confirm support before using it in production.
- How do I define entitlements in the config file?
- Entitlement sets are defined in the addon's config file, so you can describe who can access what without database schema changes. Add or adjust entitlement definitions in config and keep the names consistent with the checks in your templates and code. This config-driven approach makes access rules easier to review and audit.
- How do I assign entitlements to users or roles?
- You attach entitlements to users or roles, and the addon resolves permission checks from those assignments. Use the addon's assignment API or documented user and role workflow rather than hard-coding access rules in templates. Once assigned, the same entitlements can be checked across content, entries, and routes.
- Can I protect entries, collections, and routes with template tags?
- Yes. The addon is designed to gate entries, collections, and routes using template tags, with middleware also available for route protection. You can use those checks to show or hide content based on the current user's entitlements. Keep the entitlement names in your templates aligned with your config definitions.
- How do I check a user's entitlements in my own PHP code?
- Use the addon's simple API for custom access checks in your own PHP code. The goal is to centralize entitlement logic so you can call a permission check instead of duplicating role or user conditions. Refer to the package documentation for the exact method names and return values.
- Does Statamic Entitlements work with Statamic's built-in permissions?
- Yes. Statamic Entitlements is intended to work alongside Statamic's built-in permissions. You can keep using core permissions for standard control while using entitlements for config-driven access sets. This lets you layer membership or feature access without replacing Statamic's permission system.
- Can I use it for member-only pages, tiered subscriptions, or client portals?
- Yes. The addon is aimed at use cases such as member-only pages, tiered subscriptions, gated content, and per-client content portals. You define entitlement sets, assign them to users or roles, and then check them in templates or middleware. That keeps access logic centralized instead of scattered across hard-coded conditions.
- How should I test entitlement checks in my Laravel application?
- Create test users with and without the relevant entitlements, then assert the expected template output and route responses. Keep entitlement definitions in config so tests can rely on known sets and avoid hidden database state. Use Laravel's HTTP and view testing tools, plus any Statamic testing helpers available in your project.
- Is there middleware for gating routes and how do I use it?
- The addon supports gating routes with middleware as well as template tags. Register or apply the provided middleware to the routes you want to protect, then ensure the authenticated user has the required entitlement. Check the package documentation for the exact middleware class name and expected configuration.