Installation

Requirements

  • PHP 8.2+
  • Laravel 10.x or 11.x or 12.x

Install via Composer

composer require featureflags/laravel

Publish Configuration

php artisan vendor:publish --tag="featureflags-config"

This will create config/featureflags.php in your application.

Set Your API Key

Add your environment's API key to your .env file:

# Get this from your project's Environments page in the dashboard
FEATURE_FLAGS_API_KEY=ff_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Use different keys per environment

Each environment (production, staging, local) has its own API key. This ensures flag configurations are isolated.

Verify Installation

Run this artisan command to verify the package can connect to the API:

php artisan featureflags:sync

You should see output like:

Syncing feature flags...
Successfully synced 5 flags.
Cache refreshed.

Optional: Set Up Webhooks

For instant flag updates, configure webhooks in your project settings and enable the webhook route:

// config/featureflags.php
'webhook' => [
    'enabled' => true,
    'path' => '/webhooks/feature-flags',
    'secret' => env('FEATURE_FLAGS_WEBHOOK_SECRET'),
],

Then register the route in your routes/web.php:

Route::featureFlagsWebhook();

This will automatically invalidate your local cache when flags change in the dashboard.

Next Steps