laravel/spark-installer
Command-line installer for Laravel Spark. Clone and composer install, add to PATH, then register with your Spark API token. Use spark new to scaffold a new Spark project and run migrations to finish setup.
Install the Package Clone the repository and run:
git clone https://github.com/laravel/spark-installer.git
cd spark-installer
composer install
Add the cloned directory to your system PATH to use the spark CLI globally.
Register Your License Purchase a Spark license from Laravel Spark and register it:
spark register YOUR_API_TOKEN
Verify registration with:
spark whoami
Create Your First Project Scaffold a new Spark project:
spark new my-spark-app
cd my-spark-app
Run migrations and start the dev server:
php artisan migrate
php artisan serve
Use spark new to bootstrap a SaaS project with pre-configured:
Generate a Project
spark new my-app --team # Includes team features
spark new my-app --stripe # Enables Stripe billing
Flags like --team, --stripe, and --vue customize the scaffold.
Post-Creation Setup
.env for app URL, billing keys, and mail settings.php artisan migrate --seed
npm install && npm run dev
Team Development
spark CLI across a team by storing it in a shared directory (e.g., /usr/local/spark).spark new with consistent flags to maintain uniformity.Integration with Existing Laravel Apps
config/spark.php and resources/views/vendor/spark into your project.database/migrations) if needed.SparkServiceProvider) as a reference for features like billing or teams..env (SPARK_LICENSE) for automated deployments.resources/views/vendor/spark without modifying the original files.createTeam(), createSubscription()) in PHPUnit tests.License Registration
spark new fails with License not registered.
Fix: Run spark register again or check your API token from Spark’s dashboard.spark binary to offline machines.Outdated Dependencies
composer.json if needed (e.g., laravel/framework to ^8.0).Frontend Conflicts
node_modules and package-lock.json, then run npm install with --force if necessary.Database Migrations
mysql database. For PostgreSQL/SQLite, edit config/database.php before running migrate.php artisan spark:install to re-run Spark’s setup if migrations are skipped.Custom Domains
localhost. For production, update:
.env (APP_URL=https://yourdomain.com)config/spark.php (domain and secure settings).spark new --verbose to debug project generation.storage/logs/laravel.log for Spark-related errors.spark:install (re-run setup)spark:publish (publish assets/views)spark:team:create (create a test team).Customize the Installer
src/NewProjectCommand.php to add your own project templates.--custom-flag to include a custom module.Post-Install Hooks
app/Providers/SparkServiceProvider to extend functionality (e.g., add custom billing logic).CI/CD Integration
spark CLI in Docker or CI pipelines to avoid re-downloading.- name: Install Spark
run: |
git clone https://github.com/laravel/spark-installer.git
cd spark-installer && composer install
sudo mv spark /usr/local/bin/
Local Development Tricks
ln -s /path/to/spark-installer/spark /usr/local/bin/spark
How can I help you explore Laravel packages today?