mberatsanli / laravel-adapty
Laravel Adapty
Installs: 1 023
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.5
- illuminate/contracts: ^9.0
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
README
A Laravel package for the Adapty SDK. Please feel free to contribute...
Installation
You can install the package via composer:
composer require mberatsanli/laravel-adapty
You can publish the config file with:
php artisan vendor:publish --tag="adapty-config"
This is the contents of the published config file:
return [ 'base_url' => env('ADAPTY_BASE_URL', 'https://api.adapty.io/api/v1/sdk'), 'secret_token' => env('ADAPTY_SECRET_TOKEN'), // Your adapty secret token. 'webhook' => [ 'path' => env('ADAPTY_WEBHOOK_PATH', '/adapty/webhook'), // webhook endpoint's path 'middleware' => [] // If you want to use middleware on the webhook endpoint, you can adjust that configuration ], ];
Usage
// Create a user $createResponse = \MBS\LaravelAdapty\LaravelAdapty::createUser('<USER ID>'); // Get information about the user $informationResponse = \MBS\LaravelAdapty\LaravelAdapty::userInformation('<USER ID -- OR -- Adapty Profile ID>'); // Set attributes to the user $setAttributesResponse = \MBS\LaravelAdapty\LaravelAdapty::setUserAttributes('<USER ID -- OR -- Adapty Profile ID>', [ // see https://docs.adapty.io/docs/server-side-api-specs#set-the-users-attribute ]); // see https://docs.adapty.io/docs/getting-started-with-server-side-api#case-2-grant-a-subscription $grantRequest = \MBS\LaravelAdapty\Http\Requests\GrantSubscriptionRequest::make(7, ....); $grantResponse = \MBS\LaravelAdapty\LaravelAdapty::grantSubscription('<USER ID -- OR -- Adapty Profile ID>', $grantRequest); // See https://docs.adapty.io/docs/server-side-api-specs#revoke-subscription-from-a-user $revokeSubscriptionResponse = \MBS\LaravelAdapty\LaravelAdapty::revokeSubscription(profileId: '<USER ID -- OR -- Adapty Profile ID>', accessLevel: 'premium', isRefund: <bool>)
Testing
No tests available for now
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please feel free to contributing...
Credits
License
The MIT License (MIT). Please see License File for more information.