Skip to main content

Class-Based Features

Instead of referencing feature keys as magic strings like 'exports' or 'projects', you can define feature classes for type safety, IDE autocompletion, and safe refactoring.

Creating a feature class

Implement Pixelworxio\Subscribd\Contracts\Feature:

Checking with a feature class

Pass the class or an instance directly to allows() and limit():

Feature class with a default limit

Define a default limit on the class itself. When the plan does not specify a value for the feature, this default is used as a fallback:

Organising feature classes

A simple approach is a App\Features\ namespace with one class per feature:

Next steps