Updating Spike
You will need a valid license key to install and update Spike.
You can get a Single or Unlimited license from here.
Spike is an ever-evolving project and your license allows 1 year of updates for free. After the 1 year of updates passes, you will be able to update to the latest version available before the one year expired. In order to continue receiving updates after 1 year, you will need to purchase another year of updates (at a discount) by logging in to your account here.
Updating the package to the latest version
First, run the Composer command:
composer update opcodes/spike
Next, run the spike:update
Artisan command which will update any assets you have previously published,
such as Assets or Translations.
php artisan spike:update
Configuration files and Views will not be updated automatically, so please review the latest default config file in vendor/opcodes/spike/config/spike.php
and copy over any values that are new and relevant to you. This is not necessary, as any updates will have sensible and backwards-compatible defaults to the configuration. You can also find all the config values documented on this website.
Upgrading from Spike v2 to v3
Spike v3 changes a few small concepts and contains a few configuration file changes to allow for multiple payment providers.
Below is a guide to upgrade your current Spike v2 installation to the latest Spike v3 version.
Estimated time to upgrade: 10 minutes
Step 1 - Update the Spike package
Spike v3 no longer depends on the Cashier (Stripe) package, but in order to continue using Stripe as your payment provider, you will need to manually require it. Therefore, it's best to update and require both packages:
composer require opcodes/spike:"^3.0" laravel/cashier:"^15.0" dompdf/dompdf -W
The above command will update Spike, Cashier (Stripe), and also require dompdf/dompdf
which is optional since Cashier v14, but required by Spike to download invoices.
Step 2 - Update SpikeBillable import
The SpikeBillable
trait has been moved to Opcodes\Spike\Stripe\SpikeBillable
to signify it should only be used with the Stripe payment provider.
Please update your billable classes to use the updated namespace for the trait.
Step 3 - Update Spike configuration file
Because Spike v3 contains a few structural changes, it's best to overwrite the configuration file with the newest version.
First, take a backup of your current config/spike.php
configuration file:
mv config/spike.php config/spike-v2.php
Next, publish the newest configuration file:
php artisan vendor:publish --tag=spike-config
Then, compare the two versions of Spike configuration and copy over any values from the old configuration to the new one in their respective places.
theme.credit_icon
- if you previously had set this option in Spike v2, it has now been moved tocredit_types.0.icon
. Each credit type can have its own icon and accepts either URL, an SVG string, ornull
(the default icon).stripe_checkout
has been moved tostripe.checkout
subscriptions
- a couple of options have changed when defining subscription plans. Please see an example diff below:
'subscriptions' => [
[
'id' => 'standard',
- 'stripe_price_id_monthly' => 'price_monthly',
- 'stripe_price_id_yearly' => 'price_yearly',
+ 'payment_provider_price_id_monthly' => 'price_monthly',
+ 'payment_provider_price_id_yearly' => 'price_yearly',
- 'monthly_credits' => 500,
+ 'provides_monthly' => [
+ CreditAmount::make(500),
+ ],
],
],
To learn more about the CreditAmount
class, please see the Providables documentation.
products
- a couple of options have changed when defining products. Please see an example diff below:
'products' => [
[
'id' => '10_dollars',
- 'stripe_price_id' => 'price_10_dollars',
+ 'payment_provider_price_id' => 'price_10_dollars',
- 'credits' => 500,
- 'expires_after' => \Carbon\CarbonInterval::months(6),
+ 'provides' => [
+ CreditAmount::make(500)->expiresAfterMonths(6),
+ ],
],
],
invoice_details
has been moved tostripe.invoice_details
allow_discount_codes
has been moved tostripe.allow_discount_codes
persist_discounts_when_switching_plans
has been moved tostripe.persist_discounts_when_switching_plans
Step 4 - Run spike:update
php artisan spike:update
The command will copy over the new migrations, translations, assets, and the layout if you have previously published these.
If you have made any changes to the layout, please apply them again.
Step 5 - Run the migrations
Run the database migrations to update your Spike tables.
php artisan migrate
Note that you will see Cashier (Stripe) tables copied over to stripe_subscriptions
and stripe_subscription_items
. There, after migrations, you should find the exact same data as in your old subscriptions
and subscription_items
tables. After verifying that, you can safely remove the old deprecated tables, or keep them if needed.
Other notable changes
- The console command
spike:renew-subscription-credits
has been renamed tospike:renew-subscription-providables
to better reflect its behaviour. If you previously scheduled the command, please rename it in your scheduler configuration. Opcodes\Spike\Facades\SpikeSubscription
facade has been removed. Subscriptions should be managed via the provided methods on the billable class.Opcodes\Spike\Facades\Spike::ignoreMigrations()
method has been removed. From now on, all migrations are published to your app, and only those are run.
That's it!
Congratulations, you have now upgraded to Spike v3. Here are a few useful links to learn about the new features of Spike v3:
- Credit types - you can now sell and spend multiple types of credits
- Paddle payment provider - you can now use Paddle as the payment provider