Skip to main content

Installation

Requirements​

  • PHP ^8.4
  • Laravel ^13.0

Both are floors rather than exact versions: any Laravel 13 release works, and the package declares the individual illuminate/* components it uses rather than the full framework, so it adds nothing to an application that already has them.

composer require pushery/billing-for-laravel

The service provider is registered automatically through package discovery. The Stripe driver builds on Cashier, so set your Stripe keys (STRIPE_KEY, STRIPE_SECRET, STRIPE_WEBHOOK_SECRET) as usual.

An application that requires ext-intl declares Cashier's intl polyfill as replaced. Cashier requires symfony/polyfill-intl-icu, whose classmap maps NumberFormatter, Collator and IntlDateFormatter to the polyfill's stubs, and Composer writes those entries into the autoloader even where the extension is loaded. Nothing changes at runtime, because the extension's classes exist before the autoloader is asked, but static analysis reads the intl classes through the polyfill and reports errors on lines that never changed:

"replace": {
"symfony/polyfill-intl-icu": "*"
}

Without the extension, leave the line out: the polyfill is then what answers for those classes.

Then run the installer:

php artisan billing:install
php artisan migrate

Billable model isn't App\Models\User? billing:install reads the target table from billing.customer.model when it generates the migration, so set BILLING_CUSTOMER_MODEL in your .env (or pass --table=your_table) before you run it. Otherwise it adds the billing columns to users.

billing:install publishes the config and generates a migration that adds the tier column (plan) and the Cashier customer columns (stripe_id, pm_type, pm_last_four, trial_ends_at) to your owner model's table — the columns that live on your table, which no package migration can create without knowing which table it is. It targets the table of billing.customer.model (or users); override with --table.

Renamed billing.tier_column or billing.customer.column? The generated migration follows your config, and every package surface reads the column you configured. The one boundary is Cashier's own API (Cashier::findBillable(), the Billable trait), which is hardcoded to stripe_id — so rename freely unless you also drive Cashier directly.

The package's own server-side billing tables load automatically; publish them only if you would rather manage them in your app:

php artisan vendor:publish --tag=billing-migrations

Once they are published, stop the package from loading its own copies, or migrate runs both: call BillingServiceProvider::ignoreMigrations() in the register() method of your AppServiceProvider. After an update, run the same command again. It copies only the migrations the update added, each under a fresh timestamp, and leaves the ones you already hold alone, whatever timestamp they carry. --force rewrites those in place.

Next: Configuration.


← Back to the documentation index