Pre-1.0. Not intended for public use yet. The API is subject to undocumented change, and these pages may already be wrong about it.

Skip to content

Installation ​

Install Storyfeed and create the tables that store your activities.

Requirements ​

PHP8.4+
Laravel12 or 13
DatabaseMySQL, PostgreSQL, SQLite, or SQL Server

Installing Storyfeed ​

bash
composer require storyfeed/storyfeed:dev-main

The service provider registers through package discovery.

Running the Installer ​

The installer publishes the configuration and migrations and creates routes/feed.php:

bash
php artisan storyfeed:install

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:

bash
php artisan migrate

The 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:

app/Providers/AppServiceProvider.phpboot()
php
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.

app/Providers/AppServiceProvider.phpboot()
php
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:

bash
composer require storyfeed/ui

Install Tailwind's Typography plugin:

bash
npm install -D @tailwindcss/typography

Register the plugin and the package's views in resources/css/app.css:

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.

Released under the MIT License.