Overview of Next-Generation Spark Laravel Spark serves as a dedicated SaaS toolkit designed to handle the heavy lifting of recurring billing. Unlike earlier versions, the next generation of Spark is front-end agnostic, meaning it provides a totally isolated billing portal that exists separately from your main application logic. This architectural shift grants you total freedom to use any stack—whether Vue.js, React, or simple Blade templates—without the billing logic cluttering your UI. Prerequisites and Toolkit To follow this implementation, you should be comfortable with the Laravel framework and basic terminal operations. Key Libraries & Tools * **Laravel Breeze**: A minimal, simple starter kit for scaffolding authentication. * **Paddle**: A merchant of record that handles VAT taxes and provides PayPal integration. * **Stripe**: The alternative payment provider supported by Spark. * **Tailwind CSS**: The utility-first CSS framework used for branding the portal. Implementation Walkthrough Start by scaffolding authentication using Laravel Breeze. Once your users can log in, install the Paddle edition of Spark via Composer: ```bash composer require laravel/spark-paddle php artisan spark:install ``` Next, integrate the `Billable` trait into your `User` model. This connects your database entities to the Spark billing engine. ```python use Spark\Billable; class User extends Authenticatable { use Billable; } ``` Configuring Subscription Plans Plans reside in `config/spark.php`. Here, you define your monthly and yearly IDs—which you fetch from your Paddle dashboard—along with feature lists. Spark uses these to automatically generate the pricing toggle in the billing portal. Branding and UI Integration Customizing the portal to match your brand (like the green aesthetic of Laravel Forge) happens in the `branding` section of the config. You can swap the logo and primary button colors using Tailwind CSS classes. To link users to the portal, simply point a navigation link to the `/billing` route defined in your configuration. Practical Tips & Gotchas Always use the `onTrial` method to show trial banners in your UI. One common mistake is forgetting to set up webhooks; Laravel Spark relies on webhooks to process subscription status changes. If your local environment isn't receiving these, your application won't know when a user has successfully paid.
Laravel Spark
Software
- Feb 11, 2021
- Dec 31, 2020