PHP code example of hulkapps / appmanager

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

    

hulkapps / appmanager example snippets


php artisan vendor:publish --provider="HulkApps\AppManager\AppManagerServiceProvider"

'app-manager-failsafe' => [
			'driver' => 'mysql',
			'host' => env('FAILSAFE_DB_HOST', '127.0.0.1'),
			'port' => env('FAILSAFE_DB_PORT', '3306'),
			'database' => env('FAILSAFE_DB_DATABASE', 'forge'),
			'username' => env('FAILSAFE_DB_USERNAME', 'forge'),
			'password' => env('FAILSAFE_DB_PASSWORD', ''),
			'unix_socket' => env('FAILSAFE_DB_SOCKET', ''),
			'charset' => 'utf8mb4',
			'collation' => 'utf8mb4_unicode_ci',
			'prefix' => '',
			'prefix_indexes' => true,
			'strict' => false,
			'engine' => null,
			'options' => extension_loaded('pdo_mysql') ? array_filter([
				PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
			]) : [],
		];

use HulkApps\AppManager\app\Events\PlanActivated;

class EventServiceProvider extends ServiceProvider {
    protected $listen = [
		PlanActivated::class => [
			PlanActivatedListener::class,
		],
	];
}

use HulkApps\AppManager\app\Traits\HasPlan;

class User extends Model
{
	use HasPlan;
}

$user->hasPlan(); // If the user has plan or not

$user->planFeatures(); // Return the active plan's features with value

$user->hasFeature($featureSlug); // Return the user has given the feature or not

$user->getFeature($featureSlug); // Return data for a feature

$user->getRemainingDays(); // Calculate the remaining days of the active plan

$user->getPlanData(); // Return plan details

$user->getChargeData(); // Return active and recent cancelled charge

$user->setDefaultPlan($plan_id); // Set default plan_id( plan_id Optional)

'total_trial_days' => env('TOTAL_TRIAL_DAYS', 'toal_trial_days'),
bash
composer dump-autoload