1. Go to this page and download the library: Download osenco/subscriptions library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
osenco / subscriptions example snippets
use Osen\Subscriptions\Concerns\HasSubscriptions;
class User extends Authenticatable
{
use HasSubscriptions; // <- here
}
use Osen\Subscriptions\Facades\Plan;
...
Plan::called('Basic')
->describedAs('Basic plan')
->pricedAt(1000)
->interval('month') // or interval('months', 5)
->trialDays(30)
->active()
->save();
use Osen\Subscriptions\Facades\Subscription;
use Osen\Subscriptions\Facades\Subscribe;
$user = User::find(1);
$plan = Plan::find(1);
$subscription = $user->subscribeTo($plan, 1);
//OR use the Subscribe Facade for one or multiple users
$subscription = Subscribe::subscriber($user)->to($plan, 1);
$subscription = Subscribe::subscribers($userIds)->to($plan, 1);