gridwb/laravel-adapty
最新稳定版本:1.1.2
Composer 安装命令:
composer require gridwb/laravel-adapty
包简介
adapty.io API for Laravel
README 文档
README
Laravel Adapty is a convenient wrapper for interacting with the Adapty API in Laravel applications.
Table of Contents
Installation
-
Install the package
composer require gridwb/laravel-adapty
-
Publish the configuration file
php artisan vendor:publish --tag="adapty-config" -
Add environment variables
ADAPTY_API_URL=https://api.adapty.io ADAPTY_API_KEY=your-api-key-here ADAPTY_WEBHOOK_PATH=webhooks/adapty ADAPTY_WEBHOOK_SECRET=your-webhook-secret-here
Usage
Profile Resource
get profile
Get profile request:
<?php use Gridwb\LaravelAdapty\Facades\Adapty; // Get profile by `customer_user_id` $customerUserId = '<string>'; $response = Adapty::profile()->getProfile(customerUserId: $customerUserId); // Get profile by `profile_id` $profileId = '<string>'; $response = Adapty::profile()->getProfile(profileId: $profileId); echo $response->appId; echo $response->customerUserId; echo $response->customerUserId; // ...
delete profile
Delete profile request:
<?php use Gridwb\LaravelAdapty\Facades\Adapty; // Delete profile by `customer_user_id` $customerUserId = '<string>'; Adapty::profile()->deleteProfile(customerUserId: $customerUserId); // Delete profile by `profile_id` $profileId = '<string>'; Adapty::profile()->deleteProfile(profileId: $profileId);
Webhooks
Adapty can send events to your Laravel application via webhooks. By default, all webhook requests are dispatched to the
Gridwb\LaravelAdapty\Jobs\ProcessWebhook::class job, which triggers corresponding Laravel events. You can listen to
these events like any other Laravel event:
<?php use Gridwb\LaravelAdapty\Events\SubscriptionStarted; use Illuminate\Support\Facades\Event; Event::listen(SubscriptionStarted::class, function (SubscriptionStarted $event) { $payload = $event->payload; // Access data from Adapty payload });
If you need custom handling, you can define your own job and set it in the config/adapty.php:
<?php return [ 'webhook' => [ 'process_webhook_job' => \Gridwb\LaravelAdapty\Jobs\ProcessWebhook::class, ], ];
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-13