PHP code example of gridwb / laravel-adapty

1. Go to this page and download the library: Download gridwb/laravel-adapty library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gridwb / laravel-adapty example snippets




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;
// ...



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);



use Gridwb\LaravelAdapty\Facades\Adapty;

$response = Adapty::stripe()->validateStripePurchase([
    'type' => 'stripe_receipt_validation_result',
    'attributes' => [
        'customer_user_id' => '<string>',
        'stripe_token' => '<string>',
    ]
]);



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
});



return [
    'webhook' => [
        'process_webhook_job' => \Gridwb\LaravelAdapty\Jobs\ProcessWebhook::class,
    ],
];

bash
    php artisan vendor:publish --tag="adapty-config"