PHP code example of seanstewart / plan-config

1. Go to this page and download the library: Download seanstewart/plan-config 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/ */

    

seanstewart / plan-config example snippets


'providers' => [
    Seanstewart\PlanConfig\PlanConfigServiceProvider::class
];

'aliases' => [
    'Plan'       => Seanstewart\PlanConfig\Plan::class
];

if($this->getCurrentNumberOfWidgets < plan('limits.widgets'))
{
    // Allow the user to add a new widget
}

'plans' => [

    'bronze'   => [
        'limits' => [
            'widgets' => 5
        ]
    ],

    'silver'   => [
        'limits' => [
            'widgets' => 10
        ]
    ],

    //...and so on

]

'plans' => [

    'bronze' => [
        'title'       => 'Bronze Plan',
        'description' => 'This is some description for a Bronze Plan',
        'price'       => '19.00',
        'currency'    => 'USD',
        'limits'      => [
            'widgets' => 5
        ]
    ],

    'silver' => [
        'title'       => 'Silver Plan',
        'description' => 'This is some description for the Silver Plan',
        'price'       => '29.00',
        'currency'    => 'USD',
        'limits'      => [
            'widgets' => 10
        ]
    ],

    //...and so on

]

'plan_field' => 'stripe_plan'

'plans' => [

    'bronze'   => [
        'limits' => [
            'widgets' => 5
        ]
    ],

    'silver'   => [
        'limits' => [
            'widgets' => 10
        ]
    ],

    //...and so on

]

'fallback_plan' => '_default',

'plans' => [

    '_default' => [
        'limits' => [
            'purple_widgets' => 20
        ]
    ]

    'bronze'   => [
        'limits' => [
            'widgets' => 5
        ]
    ],

    'silver'   => [
        'limits' => [
            'widgets' => 10
        ]
    ],

]
js
php artisan vendor:publish --provider="Seanstewart\PlanConfig\PlanConfigServiceProvider"

'overrides' => [

        'user_model_attribute' => 'plan_overrides',

        'allowed' => ['limits.apples', 'limits.bananas'],

    ],


'plans' => [

    '_default' => [
        'limits' => [
            'purple_widgets' => 20
        ]
    ]

    'bronze'   => [
        'limits' => [
            'widgets' => 5,
            'apples' => 10,
            'bananas' => 15
        ]
    ],

    'silver'   => [
        'limits' => [
            'widgets' => 10,
            'apples' => 15,
            'bananas' => 20
        ],
    ],

]