> ## Documentation Index
> Fetch the complete documentation index at: https://docs.subscribd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Checking Features

> Determine which features a subscriber can access based on their plan

# Checking Features

Entitlements represent the features a subscriber can access based on their active plan. The `Entitlements` facade provides a clean API for checking feature access and limits.

## Basic feature check

```php theme={null}
use Pixelworxio\Subscribd\Facades\Entitlements;

if (Entitlements::for($user)->allows('exports')) {
    // User's plan includes the 'exports' feature
}
```

## Checking a limit

When a feature is a numeric limit rather than a boolean, use `limit()`:

```php theme={null}
$maxProjects = Entitlements::for($user)->limit('projects');
// Returns int — e.g. 5, or null for unlimited
```

## Checking a value

Some features hold a string value rather than a count. Compare them with `allows()`:

```php theme={null}
// Feature defined as: 'support' => 'priority'
Entitlements::for($user)->allows('support', 'priority'); // true
Entitlements::for($user)->allows('support', 'enterprise'); // false
```

## Plan feature configuration

Features are declared in `config/subscribd.php` under each plan:

```php theme={null}
'plans' => [
    'starter' => [
        'features' => [
            'projects'  => 5,         // limit of 5
            'exports'   => false,     // not available
            'api'       => true,      // available
            'support'   => 'email',   // string value
        ],
    ],
    'pro' => [
        'features' => [
            'projects'  => null,      // unlimited
            'exports'   => true,      // available
            'api'       => true,
            'support'   => 'priority',
        ],
    ],
],
```

## Gate integration

Register a gate for each feature to use Laravel's built-in `@can` directive and `Gate::allows()` calls:

```php theme={null}
// AppServiceProvider::boot()
use Pixelworxio\Subscribd\Facades\Entitlements;
use Illuminate\Support\Facades\Gate;

Gate::define('use-exports', function ($user) {
    return Entitlements::for($user)->allows('exports');
});
```

```blade theme={null}
@can('use-exports')
    <a href="{{ route('exports.create') }}">Export data</a>
@endcan
```

## Aborting on missing entitlement

```php theme={null}
abort_unless(Entitlements::for($user)->allows('api'), 403, 'Upgrade required.');
```

## Next steps

* **[Limits and Usage](/entitlements/limits-and-usage)** — Track usage against limits
* **[Class-Based Features](/entitlements/class-based)** — Type-safe feature checking
* **[Multiple Subscriptions](/entitlements/multiple-subscriptions)** — Aggregate entitlements across slots
