PHP Classes

Laravel Adapty: Help implement in-app purchases using Adapty

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 11 All time: 11,404 This week: 524Up
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
Age: 25
All time rank: 423980 in Turkey Turkey
Week rank: 195 Up3 in Turkey Turkey Up

Documentation

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 (24)  
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 (24)  /  .github  
File Role Description
Files folder imageISSUE_TEMPLATE (1 file)
Files folder imageworkflows (3 files)

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

  Files folder image Files (24)  /  .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 (24)  /  config  
File Role Description
  Accessible without login Plain text file adapty.php Aux. Auxiliary script

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

  Files folder image Files (24)  /  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 (24)  /  src  /  Data  
File Role Description
  Plain text file SubscriptionData.php Class Class source

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

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

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

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

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

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

  Files folder image Files (24)  /  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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:11
This week:0
All time:11,404
This week:524Up