Installation
Install Storyfeed and create the tables that store your activities.
Requirements
| Requirement | Version |
|---|---|
| PHP | 8.4+ |
| Laravel | 12 or 13 |
| Database | SQLite, MySQL 8.0+, MariaDB, or PostgreSQL |
Each supported database is tested in CI. MySQL 5.7 is not supported because the feed query uses window functions. SQL Server is not supported.
Your models may use integer, UUID, or ULID keys, including a mix across models, without configuration. Storyfeed stores model IDs as strings.
Installing Storyfeed
composer require storyfeed/storyfeed:dev-mainThe service provider registers through package discovery. For an existing installation, see Updating Dependencies.
Running the Installer
The installer publishes the configuration and migrations and creates routes/feed.php:
php artisan storyfeed:installIt also adds STORYFEED_SNAPSHOTS=sync to .env, and a commented line to .env.example, so changes to a model's toFeed() method show on the next reload. It leaves an existing feed file untouched. In an interactive terminal, it offers to run the migrations.
Running Migrations
If you decline that offer or run the installer non-interactively, run the migrations explicitly:
php artisan migrateThe Schema describes the tables. For manual publication or an installation without migrations, see Commands.
An app that only composes feeds from its own data can run without the tables; see Running Without Tables.
Defining Morph Aliases
Storyfeed stores each model's morph class. Without a morph map, this is the full class name. Renaming or moving the model then orphans its existing activities, as with any polymorphic relation.
We recommend defining a morph map to keep these identifiers independent of your class names. To enforce a map, register the aliases in your AppServiceProvider's boot method:
use App\Models\MenuItem;
use App\Models\Order;
use App\Models\Shop;
use App\Models\User;
use Illuminate\Database\Eloquent\Relations\Relation;
Relation::enforceMorphMap([
'order' => Order::class,
'menu_item' => MenuItem::class,
'shop' => Shop::class,
'user' => User::class,
]);Relation::enforceMorphMap() requires aliases for every polymorphic relation in your application. Choose whether to enforce this requirement for your application. Keep aliases used by existing activities in the map.
You may also list aliases in the morph_map option of config/storyfeed.php. Storyfeed merges them into your application's morph map at boot; see Configuration.
To require aliases only for Feedable models, call Storyfeed::requireFeedableMorphMap() in your service provider's boot() method. It is off by default. Enable it outside production to catch unaliased models when publishing; the doctor also reports them, and storyfeed:cache (including php artisan optimize) refuses to cache while required aliases are missing.
use Storyfeed\Facades\Storyfeed;
Storyfeed::requireFeedableMorphMap(! $this->app->isProduction());Configuration
The installer creates config/storyfeed.php. Every setting has a default; see Configuration for the available options.
Scheduling Maintenance
Storyfeed works without a scheduler. See Scheduling Maintenance for the commands to schedule in production.
Installing Storyfeed UI
Storyfeed UI supplies Blade, Vue and React components; see Installing the Kits.