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.
One dependency has a ceiling, and it is worth knowing about before it surprises you: stripe/stripe-php
is capped below major 21. Cashier already permits 21, so on a current install this package is what holds
the SDK back. The cap stands because moving a payment SDK across a major without exercising it against the
live API would be a claim nobody has checked, not because 21 is known to break anything here. If you need
21 today, that is the constraint to raise in a fork, and the reason to tell us.
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.
Then run the installer:
php artisan billing:install
php artisan migrate
Billable model isn't
App\Models\User?billing:installreads the target table frombilling.customer.modelwhen it generates the migration, so setBILLING_CUSTOMER_MODELin your.env(or pass--table=your_table) before you run it. Otherwise it adds the billing columns tousers.
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
Next: Configuration.