PHP code example of progalaxyelabs / stone-script-php

1. Go to this page and download the library: Download progalaxyelabs/stone-script-php 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/ */

    

progalaxyelabs / stone-script-php example snippets


use StoneScriptPHP\Auth\Client\MembershipClient;

$client = new MembershipClient('http://auth-service:5000');
$client->createMembership([
    'identity_id' => $userId,
    'tenant_id' => $tenantId,
    'role' => 'premium_member',
], $systemAdminToken);

'subscription' => [
    'expired_mode'         => 'read_only',        // default. 'block' = legacy 402 lockout
    'write_allow_list'     => ['/devices/pair'],  // extra writes allowed while read-only
    'warning_days'         => 7,
    'missing_subscription' => 'read_only',        // or 'allow'
],

'write_allow_list' => [
    'POST /portal/tenant/{tenantId}/account/delete',           // {param} = exactly one segment
    'POST /portal/tenant/{tenantId}/account/cancel-deletion',
    '/portal/tenant/{tenantId}/files/authorize',               // any method, and sub-paths
    'POST /devices/pairing/redeem',                            // METHOD /path = exact path
],