upwebdesign/spark
Composer 安装命令:
composer require upwebdesign/spark
包简介
Laravel Spark provides a starter scaffolding for Laravel SaaS applications.
README 文档
README
- Introduction
- Installation
- Defining Subscription Plans
- Teams
- Customizing Spark Views
- Customizing Spark JavaScript
Introduction
This is an alpha, experimental release of Spark. Things will change. Things will break. Thank you for testing!
Spark is an experimental project primarily intended for building business oriented SaaS applications, and is highly opinionated towards that use case.
Installation
First, install the Spark installer and make sure that the global Composer bin directory is within your system's $PATH:
composer global require "laravel/spark-installer=~1.0"
Next, create a new Laravel application and install Spark:
laravel new application
cd application
spark install
After installing Spark, be sure to migrate your database, install the NPM dependencies, and run the gulp command. You should also set the AUTHY_KEY, STRIPE_KEY, and STRIPE_SECRET environment variables in your .env file.
You may also wish to review the SparkServiceProvider class that was installed in your application. This provider is the central location for customizing your Spark installation.
Defining Subscription Plans
Subscription plans may be defined in your app/Providers/SparkServiceProvider.php file. This file contains a customizeSubscriptionPlans method. Within this method, you may define all of your application's subscription plans. There are a few examples in the method to get you started.
When defining a Spark plan, the plan method accepts two arguments: the name of the plan and the Stripe ID of the plan. Be sure that the Stripe ID given to the plan method corresponds to a plan ID on your Stripe account:
Spark::plan('Display Name', 'stripe-id') ->price(10) ->features([ // ]);
Yearly Plans
To define a yearly plan, simply call the yearly method on the plan definition:
Spark::plan('Basic', 'basic-yearly') ->price(100) ->yearly() ->features( // );
Coupons
To use a coupon, simply create the coupon on Stripe and access the /register route with a coupon query string variable that matches the ID of the coupon on Stripe.
http://stripe.app/register?coupon=code
Site-wide promotions may be run using the Spark::promotion method within your SparkServiceProvider:
Spark::promotion('coupon-code');
Teams
To enable teams, simply use the CanJoinTeams trait on your User model. The trait has already been imported in the top of the file, so you only need to add it to the model itself:
class User extends Model implements TwoFactorAuthenticatableContract, BillableContract, CanResetPasswordContract { use Billable, CanJoinTeams, CanResetPassword, TwoFactorAuthenticatable; }
Once teams are enabled, a team name will be required during registration, and a Teams tab will be available in the user settings dashboard.
Roles
Team roles may be defined in the customizeRoles method of the SparkServiceProvider.
Customizing Spark Views
You may publish Spark's common Blade views by using the vendor:publish command:
php artisan vendor:publish --tag=spark-basics
All published views will be placed in resources/views/vendor/spark.
If you would like to publish every Spark view, you may use the spark-full tag:
php artisan vendor:publish --tag=spark-full
Customizing Spark JavaScript
The resources/assets/js/spark/components.js file contains the statements to load some common Spark Vue components. Vue is the JavaScript framework used by the Spark registration and settings screens.
You are free to change any of these require statements to load your own Vue component for a given screen. Most likely, you will want to copy the original component as a starting point for your customization.
upwebdesign/spark 适用场景与选型建议
upwebdesign/spark 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 05 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「stripe」 「laravel」 「scaffolding」 「billing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 upwebdesign/spark 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 upwebdesign/spark 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 upwebdesign/spark 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Flexible payment integration for Laravel, lunarphp, supporting multiple payment providers.
Rich payment solutions for Laravel framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
Alfabank REST API integration
A simple Symfony bundle for Stripe API.
Layer Architecture for Laravel (Service, Repository, Entity)
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-05-15