hulkapps / appmanager
Installs: 3 588
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
Requires
- php: ^7.3|^7.4|^8.0
- ext-json: *
- guzzlehttp/guzzle: >=6.4.1
- illuminate/support: >=6.0
Requires (Dev)
- orchestra/testbench: ^4.0
- phpunit/phpunit: ^9.0
- dev-master
- 2.5.4
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.9
- 2.4.8
- 2.4.7
- 2.4.6
- 2.4.5
- 2.4.4
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.9
- 2.3.8
- 2.3.7
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.9
- 2.2.8
- 2.2.7
- 2.2.6
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.9
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.0
- dev-develop
- dev-failsafe-data-sync-script
- dev-code_improvements
- dev-global_plan
- dev-discount-value
- dev-app-manager-cache
- dev-discount_integration
- dev-plan_discount
- dev-api-version-2024-01
- dev-dev-chirag
- dev-failsafe-db
- dev-charge-helper
- dev-manage-plan
- dev-graphql-helper
- dev-test_case_module
This package is auto-updated.
Last update: 2024-11-08 10:47:58 UTC
README
Requirements
- SQLite
- Redis Server for cache (File will work too, but not recommended)
Installation
You can install the package via composer:
composer require hulkapps/appmanager
composer dump-autoload
Configuration
1.Initialize App Manager Config
php artisan vendor:publish --provider="HulkApps\AppManager\AppManagerServiceProvider"
In the case that config/app-manager.php is already present, delete it and then run the command below.
Don't forget to update secret on file config/app-manager.php
2.Initialize App Features
According to the example in the file, list all features of the app in config/plan-features.php
.
Ensure you use the UIID from this sheet, and don't forget to mention the app name after using the UUID
3.Initialize Fail-safe Database
Initialize MYSQL Fail-safe database in config/database.php
'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'), ]) : [], ];
4.Listen Plan Activation Event
Listen and Register plan activation event in app/Providers/EventServiceProvider
.
use HulkApps\AppManager\app\Events\PlanActivated; class EventServiceProvider extends ServiceProvider { protected $listen = [ PlanActivated::class => [ PlanActivatedListener::class, ], ]; }
Usage
Plan and feature helper functions are provided in this package.
Bind trait with user model
use HulkApps\AppManager\app\Traits\HasPlan; class User extends Model { use HasPlan; }
Helper functions
$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)
Extras
Set Shopify API version to 2022-04.
Store plan's total trial Days in shop table (Optional)
Set total_trial_days field name in config/app-manager.php
'total_trial_days' => env('TOTAL_TRIAL_DAYS', 'toal_trial_days'),
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email divyank@hulkapps.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.