> ## Documentation Index
> Fetch the complete documentation index at: https://docs.subscribd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install Subscribd in your Laravel application and run migrations

# Installation

Get Subscribd installed and configured in a few minutes.

## Requirements

* PHP 8.3 or higher
* Laravel 12 or 13
* A supported database (MySQL, PostgreSQL, or SQLite)

## Install via Composer

Subscribd is distributed through a private Composer repository. Add the repository and require the package:

```bash theme={null}
composer require pixelworxio/subscribd
```

The service provider registers itself automatically via Laravel's package discovery. Two facades are aliased for convenience: `Subscribd` and `Entitlements`.

## Publish assets

### Configuration

```bash theme={null}
php artisan vendor:publish --tag=subscribd-config
```

This creates `config/subscribd.php`. At minimum, set your default gateway and currency:

```php theme={null}
// config/subscribd.php
return [
    'default'  => env('SUBSCRIBD_GATEWAY', 'stripe'),
    'currency' => env('SUBSCRIBD_CURRENCY', 'USD'),

    'billables' => [
        'user' => \App\Models\User::class,
    ],
    // ...
];
```

### Migrations

```bash theme={null}
php artisan vendor:publish --tag=subscribd-migrations
php artisan migrate
```

This creates the following tables:

| Table                          | Purpose                              |
| ------------------------------ | ------------------------------------ |
| `subscribd_plans`              | Plan definitions synced from config  |
| `subscribd_plan_items`         | Composable add-ons per plan          |
| `subscribd_subscriptions`      | Active and historical subscriptions  |
| `subscribd_subscription_items` | Per-subscription PlanItem quantities |
| `subscribd_invoices`           | All charges and their status         |
| `subscribd_invoice_lines`      | Line items on each invoice           |
| `subscribd_payment_methods`    | Stored customer payment instruments  |
| `subscribd_coupons`            | Discount codes                       |
| `subscribd_credits`            | Account credit balance               |
| `subscribd_usage_records`      | Metered billing usage                |
| `subscribd_webhook_events`     | Idempotent webhook log               |

### Livewire components and views

```bash theme={null}
php artisan vendor:publish --tag=subscribd-views
```

Published to `resources/views/vendor/subscribd/`.

### Translation files

```bash theme={null}
php artisan vendor:publish --tag=subscribd-translations
```

Published to `lang/vendor/subscribd/`. Ships with `en`, `es`, `fr`, `de`, and `zh-CN`.

## Environment variables

Add your gateway credentials to `.env`. Only the gateway you intend to use is required:

```env theme={null}
SUBSCRIBD_GATEWAY=stripe
SUBSCRIBD_CURRENCY=USD

# Stripe
STRIPE_KEY=pk_live_...
STRIPE_SECRET=sk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...

# PayPal
PAYPAL_CLIENT_ID=...
PAYPAL_CLIENT_SECRET=...
PAYPAL_WEBHOOK_ID=...
PAYPAL_MODE=live

# Braintree
BRAINTREE_ENV=production
BRAINTREE_MERCHANT_ID=...
BRAINTREE_PUBLIC_KEY=...
BRAINTREE_PRIVATE_KEY=...

# Paddle
PADDLE_API_KEY=...
PADDLE_WEBHOOK_SECRET=...

# FastSpring
FASTSPRING_USERNAME=...
FASTSPRING_PASSWORD=...
FASTSPRING_WEBHOOK_SECRET=...
FASTSPRING_STOREFRONT_URL=...

# Square
SQUARE_ACCESS_TOKEN=...
SQUARE_APPLICATION_ID=...
SQUARE_LOCATION_ID=...
SQUARE_WEBHOOK_SIGNATURE_KEY=...
```

## Sync plans

After publishing the configuration and defining your plans, sync them to the database:

```bash theme={null}
php artisan subscribd:install
```

This seeds the `subscribd_plans` and `subscribd_plan_items` tables from your `config/subscribd.php` `plans` array.

## Run the health check

Verify the installation and gateway connectivity:

```bash theme={null}
php artisan subscribd:check
```

The command reports your configured gateway, currency, registered billable types, and plan count.

## Schedule recurring commands

Add the following to your `routes/console.php` (or `app/Console/Kernel.php` on Laravel 10) to enable dunning, trial expiry, and ARR snapshots:

```php theme={null}
use Illuminate\Support\Facades\Schedule;

Schedule::command('subscribd:expire-subscriptions')->daily();
Schedule::command('subscribd:expire-trials')->hourly();
Schedule::command('subscribd:dispatch-trial-ending-events')->daily();
Schedule::command('subscribd:check-payment-method-expiry')->daily();
Schedule::command('subscribd:snapshot-arr')->dailyAt('00:00');
```

## Next steps

* **[Billable Models](/getting-started/billable-models)** — Make your User model billable
* **[Plans](/getting-started/plans)** — Define your pricing tiers
* **[Stripe Gateway](/gateways/stripe)** — Configure Stripe with checkout modes and webhooks
