PHP Classes

Laravel Adapty: Help implement in-app purchases using Adapty

Recommend this page to a friend!
  Info   View files Documentation   View files View files (24)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-09-14 (2 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 9 All time: 10,812 This week: 189Up
Version License PHP version Categories
laravel-adapty 1.0The PHP License5E-Commerce, Web services
Description Author

This package can help implement in-app purchases using Adapty.

It provides a Laravel service class that can send HTTP requests to Adapty API to provide several types of services.

Currently, it can:

- Create an Adapty user for a customer

- Retrieve the information of a given Adapty user

- Set the attributes of an user

- Grant a paid subscription to a given user

- Revoke the subscription of a given user

Picture of Melih Berat SANLI
Name: Melih Berat SANLI <contact>
Classes: 3 packages by
Country: Turkey Turkey

Details

Laravel Adapty

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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\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.

  Files folder image Files  
File Role Description
Files folder image.github (2 directories)
Files folder imageconfig (1 file)
Files folder imageroutes (1 file)
Files folder imagesrc (2 files, 6 directories)
Files folder imagetests (3 files)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpstan.neon.dist Data Auxiliary data
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
Files folder imageISSUE_TEMPLATE (1 file)
Files folder imageworkflows (3 files)

  Files folder image Files  /  .github  /  ISSUE_TEMPLATE  
File Role Description
  Accessible without login Plain text file config.yml Data Auxiliary data

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file phpstan.yml Data Auxiliary data
  Accessible without login Plain text file run-tests.yml Data Auxiliary data
  Accessible without login Plain text file update-changelog.yml Data Auxiliary data

  Files folder image Files  /  config  
File Role Description
  Accessible without login Plain text file adapty.php Aux. Auxiliary script

  Files folder image Files  /  routes  
File Role Description
  Plain text file adapty.php Class Class source

  Files folder image Files  /  src  
File Role Description
Files folder imageData (1 file)
Files folder imageFacades (1 file)
Files folder imageHttp (1 directory)
Files folder imageRequests (1 file)
Files folder imageResponses (1 file)
Files folder imageTraits (1 file)
  Plain text file LaravelAdapty.php Class Class source
  Plain text file LaravelAdaptyServiceProvider.php Class Class source

  Files folder image Files  /  src  /  Data  
File Role Description
  Plain text file SubscriptionData.php Class Class source

  Files folder image Files  /  src  /  Facades  
File Role Description
  Plain text file LaravelAdapty.php Class Class source

  Files folder image Files  /  src  /  Http  
File Role Description
Files folder imageControllers (1 file)

  Files folder image Files  /  src  /  Http  /  Controllers  
File Role Description
  Plain text file AdaptyWebhookController.php Class Class source

  Files folder image Files  /  src  /  Requests  
File Role Description
  Plain text file GrantSubscriptionRequest.php Class Class source

  Files folder image Files  /  src  /  Responses  
File Role Description
  Plain text file AdaptyResponse.php Class Class source

  Files folder image Files  /  src  /  Traits  
File Role Description
  Plain text file HasAttributes.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file ExampleTest.php Example Example script
  Plain text file Pest.php Class Class source
  Plain text file TestCase.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:9
This week:0
All time:10,812
This week:189Up