Installation
Install Storyfeed and create the tables that store your activities.
Requirements
| PHP | 8.4+ |
| Laravel | 12 or 13 |
| Database | MySQL, PostgreSQL, SQLite, or SQL Server |
Installing Storyfeed
composer require storyfeed/storyfeed:dev-mainThe service provider registers through package discovery.
Running the Installer
The installer publishes the configuration and migrations and creates routes/feed.php:
php artisan storyfeed:installIt 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.
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, and keep aliases used by existing activities in the map.
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.
The feed works without a scheduler; once it is live, Storyfeed has maintenance commands worth scheduling.
Installing Storyfeed UI
To render a feed with Blade components styled using Tailwind CSS v4, install Storyfeed UI:
composer require storyfeed/uiInstall Tailwind's Typography plugin:
npm install -D @tailwindcss/typographyRegister the plugin and the package's views in resources/css/app.css:
@source "../../vendor/storyfeed/ui/resources/views";
@plugin "@tailwindcss/typography";Run npm run build to compile your application's CSS. See Rendering to display the feed or build your own components.