1. Go to this page and download the library: Download lacodix/membergy-sdk-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/ */
lacodix / membergy-sdk-php example snippets
use Lacodix\MembergySdk\Enums\EventVisibilityType;
use Lacodix\MembergySdk\Enums\SearchResultType;
use Lacodix\MembergySdk\MembergyClient;
$client = new MembergyClient(
baseUrl: 'https://membergy.app',
tenant: 'my-club',
);
$page = $client->content()->pages()->find('willkommen');
foreach ($page->content->blocks as $block) {
// Match concrete DTOs such as TitleBlock, TextBlock or ColumnsBlock.
}
$posts = $client->content()->posts()
->category('news')
->perPage(10)
->get();
$post = $client->content()->posts()->find('my-slug', ST)
->page(2)
->get();
$categories = $client->newsletter()->categories();
$client->newsletter()->subscribe('[email protected]', [$categories[0]->uuid]);
$client->newsletter()->confirm($opaqueConfirmationToken);
$client->newsletter()->requestUnsubscribe('[email protected]');
$client->withoutUserToken()->newsletter()->unsubscribeAll($opaqueUnsubscribeToken);
// From a caught TwoFactorRequiredException; the challenge expires after five minutes.
$token = $client->auth()->completeTwoFactor($challenge, code: $totpCode);
// Alternatively, exactly one factor:
$token = $client->auth()->completeTwoFactor($challenge, recoveryCode: $recoveryCode);
use Lacodix\MembergySdk\Laravel\Facades\Membergy;
$posts = Membergy::content()->posts()->get();
use Lacodix\MembergySdk\DataObjects\ContactDetail;
$client->me()->person()->update([
// Include the other
new ContactDetail($clientUuid, 'private_phone', '+513512345678', 'private'),
],
'bank_iban' => 'DE89370400440532013000',
]);