Skip to content

Commit 2ef7004

Browse files
authored
Merge pull request #46 from LoginRadius/php-sdk-11.7.0
Php sdk 11.7.0
2 parents 43b2215 + c8ef81d commit 2ef7004

6 files changed

Lines changed: 176 additions & 55 deletions

File tree

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
> **LoginRadius PHP SDK Change Log** provides information regarding what has changed, more specifically what changes, improvements and bug fix has been made to the SDK. For more details please refer to the [LoginRadius API Documention](https://www.loginradius.com/docs/api/v2/deployment/sdk-libraries/php-library/)
22
3+
# Version 11.7.0
4+
5+
**Release Date:** March 24, 2025
6+
7+
## Enhancements
8+
9+
We've introduced a brand-new set of Webhook APIs, designed with enhanced functionality and flexibility. These new APIs support advanced features including:
10+
11+
- Custom header configuration
12+
- Query parameter support
13+
- Webhook authentication methods (Bearer Token and Basic Auth)
14+
- Support for a custom `Name` parameter to label each webhook subscription
15+
16+
As part of this upgrade, the legacy Webhook APIs have been deprecated in favor of the new, more robust versions.
17+
18+
## Newly Added APIs
19+
20+
- `getWebhookSubscriptionDetail` – Retrieve detailed information about a specific webhook subscription
21+
- `createWebhookSubscription` – Create a new webhook subscription with advanced configuration options
22+
- `deleteWebhookSubscription` – Remove an existing webhook subscription
23+
- `updateWebhookSubscription` – Modify an existing webhook subscription
24+
- `listAllWebhooks` – Retrieve a list of all configured webhook subscriptions
25+
- `getWebhookEvents` – Fetch available webhook events supported by the system
26+
27+
## Deprecated APIs
28+
29+
The following legacy APIs have been deprecated:
30+
31+
- `webHookUnsubscribe`
32+
- `webhookTest`
33+
- `webHookSubscribe`
34+
- `getWebHookSubscribedURLs`
335

436
# Version 11.6.0
537

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2022 LoginRadius Inc.
1+
Copyright (c) 2025 LoginRadius Inc.
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 85 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ curl -sS https://getcomposer.org/installer | php
3737
Next, run the Composer command to install the latest stable version of library:
3838

3939
```
40-
composer require loginradius/php-sdk:11.6.0
40+
composer require loginradius/php-sdk:11.7.0
4141
```
4242

4343
Include the following files in your Project Directory
@@ -3904,71 +3904,128 @@ $result = $nativeSocialAPI->getAccessTokenByGoogleAuthCode($google_authcode,$soc
39043904
### WebHook API
39053905

39063906
List of APIs in this Section:<br>
3907-
[POST : Webhook Subscribe](#WebHookSubscribe-post-)<br>
3908-
[GET : Webhook Subscribed URLs](#GetWebHookSubscribedURLs-get-)<br>
3909-
[GET : Webhook Test](#WebhookTest-get-)<br>
3910-
[DELETE : WebHook Unsubscribe](#WebHookUnsubscribe-delete-)<br>
3907+
3908+
### WebHook API
3909+
3910+
List of APIs in this Section:<br>
3911+
[PUT : Update Webhook Subscription](#UpdateWebhookSubscription-put-)<br>
3912+
[POST : Create Webhook Subscription](#CreateWebhookSubscription-post-)<br>
3913+
[GET : Get Webhook Subscription Detail](#GetWebhookSubscriptionDetail-get-)<br>
3914+
[GET : List All Webhooks](#ListAllWebhooks-get-)<br>
3915+
[GET : Get Webhook Events](#GetWebhookEvents-get-)<br>
3916+
[DELETE : Delete Webhook Subscription](#DeleteWebhookSubscription-delete-)<br>
39113917

39123918
If you have not already initialized the WebHook object do so now
39133919
```php
39143920
$webHookAPI = new WebHookAPI();
39153921
```
39163922

39173923

3918-
<h6 id="WebHookSubscribe-post-">Webhook Subscribe (POST)</h6>
3924+
<h6 id="UpdateWebhookSubscription-put-">Update Webhook Subscription (PUT)</h6>
3925+
3926+
This API is used to update a webhook subscription
3927+
[More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/update-webhook-subscription/)
3928+
3929+
```php
3930+
3931+
$hookId = "hookId"; //Required
3932+
$payload = '{
3933+
"Headers": {
3934+
"x-test-header": "qa"
3935+
},
3936+
"QueryParams": {
3937+
"apikey": "859faf40a7c54c209360b45376bf529f"
3938+
},
3939+
"Authentication": {
3940+
"AuthType": "Basic",
3941+
"BasicAuth": {
3942+
"Username": "lrqaadmin",
3943+
"Password": "ZBz6JcnZadxc2gB7sf5vby87zBIu6q"
3944+
}
3945+
}
3946+
}'; //Required
3947+
3948+
$result = $webHookAPI->updateWebhookSubscription($hookId,$payload);
3949+
```
3950+
3951+
3952+
<h6 id="CreateWebhookSubscription-post-">Create Webhook Subscription (POST)</h6>
39193953

3920-
API can be used to configure a WebHook on your LoginRadius site. Webhooks also work on subscribe and notification model, subscribe your hook and get a notification. Equivalent to RESThook but these provide security on basis of signature and RESThook work on unique URL. Following are the events that are allowed by LoginRadius to trigger a WebHook service call.
3921-
[More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/webhook-subscribe)
3954+
This API is used to create a new webhook subscription on your LoginRadius site.
3955+
[More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/create-webhook-subscription/)
39223956

39233957
```php
39243958

39253959
$payload = '{
3926-
"event" : "<event>",
3927-
"targetUrl" : "<targetUrl>"
3960+
"event" : "<event>",
3961+
"name" : "<name>",
3962+
"targetUrl" : "<targetUrl>",
3963+
"Headers": {
3964+
"Custom-Header": "headerValue"
3965+
},
3966+
"QueryParams": {
3967+
"apikey": "yourApiKey"
3968+
},
3969+
"Authentication": {
3970+
"AuthType": "Basic",
3971+
"BasicAuth": {
3972+
"Username": "yourUsername",
3973+
"Password": "yourPassword"
3974+
}
3975+
}
39283976
}'; //Required
39293977

3930-
$result = $webHookAPI->webHookSubscribe($payload);
3978+
$result = $webHookAPI->createWebhookSubscription($payload);
39313979
```
39323980

39333981

3934-
<h6 id="GetWebHookSubscribedURLs-get-">Webhook Subscribed URLs (GET)</h6>
3982+
<h6 id="GetWebhookSubscriptionDetail-get-">Get Webhook Subscription Detail (GET)</h6>
39353983

3936-
This API is used to fatch all the subscribed URLs, for particular event
3937-
[More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/webhook-subscribed-urls)
3984+
This API is used to get details of a webhook subscription by Id
3985+
[More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/get-webhook-subscription-details/)
39383986

39393987
```php
39403988

3941-
$event = "event"; //Required
3989+
$hookId = "hookId"; //Required
39423990

3943-
$result = $webHookAPI->getWebHookSubscribedURLs($event);
3991+
$result = $webHookAPI->getWebhookSubscriptionDetail($hookId);
39443992
```
39453993

39463994

3947-
<h6 id="WebhookTest-get-">Webhook Test (GET)</h6>
3995+
<h6 id="ListAllWebhooks-get-">List All Webhooks (GET)</h6>
39483996

3949-
API can be used to test a subscribed WebHook.
3950-
[More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/webhook-test)
3997+
This API is used to get the list of all the webhooks
3998+
[More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/list-all-webhooks/)
39513999

39524000
```php
39534001

39544002

3955-
$result = $webHookAPI->webhookTest();
4003+
$result = $webHookAPI->listAllWebhooks();
39564004
```
39574005

39584006

3959-
<h6 id="WebHookUnsubscribe-delete-">WebHook Unsubscribe (DELETE)</h6>
4007+
<h6 id="GetWebhookEvents-get-">Get Webhook Events (GET)</h6>
39604008

3961-
API can be used to unsubscribe a WebHook configured on your LoginRadius site.
3962-
[More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/webhook-unsubscribe)
4009+
This API is used to retrieve all the webhook events.
4010+
[More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/get-webhook-events/)
39634011

39644012
```php
39654013

3966-
$payload = '{
3967-
"event" : "<event>",
3968-
"targetUrl" : "<targetUrl>"
3969-
}'; //Required
39704014

3971-
$result = $webHookAPI->webHookUnsubscribe($payload);
4015+
$result = $webHookAPI->getWebhookEvents();
4016+
```
4017+
4018+
4019+
<h6 id="DeleteWebhookSubscription-delete-">Delete Webhook Subscription (DELETE)</h6>
4020+
4021+
This API is used to delete webhook subscription
4022+
[More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/delete-webhook-subscription/)
4023+
4024+
```php
4025+
4026+
$hookId = "hookId"; //Required
4027+
4028+
$result = $webHookAPI->deleteWebhookSubscription($hookId);
39724029
```
39734030

39744031

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "loginradius/php-sdk",
3-
"description": "LoginRadius PHP SDK v11.6.0",
3+
"description": "LoginRadius PHP SDK v11.7.0",
44
"keywords": ["loginradius", "phpsdk"],
55
"type": "library",
66
"license": "MIT",

src/LoginRadiusSDK/CustomerRegistration/Advanced/WebHookAPI.php

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,33 @@ public function __construct($options = [])
2323

2424

2525
/**
26-
* This API is used to fatch all the subscribed URLs, for particular event
27-
* @param event Allowed events: Login, Register, UpdateProfile, ResetPassword, ChangePassword, emailVerification, AddEmail, RemoveEmail, BlockAccount, DeleteAccount, SetUsername, AssignRoles, UnassignRoles, SetPassword, LinkAccount, UnlinkAccount, UpdatePhoneId, VerifyPhoneNumber, CreateCustomObject, UpdateCustomobject, DeleteCustomObject
28-
* @return Response Containing List of Webhhook Data
26+
* This API is used to get details of a webhook subscription by Id
27+
* @param hookId Unique ID of the webhook
28+
* @return Response containing Definition for Complete WebHook data
2929
* 40.1
3030
*/
3131

32-
public function getWebHookSubscribedURLs($event)
32+
public function getWebhookSubscriptionDetail($hookId)
3333
{
34-
$resourcePath = "/api/v2/webhook";
34+
$resourcePath = "/v2/manage/webhooks/$hookId";
3535
$queryParam = [];
3636
$queryParam['apikey'] = Functions::getApiKey();
3737
$queryParam['apisecret'] = Functions::getApiSecret();
38-
if ($event === '' || ctype_space($event)) {
39-
throw new LoginRadiusException(Functions::paramValidationMsg('event'));
40-
}
41-
$queryParam['event'] = $event;
4238
return Functions::_apiClientHandler('GET', $resourcePath, $queryParam);
4339
}
4440

4541

4642

4743
/**
48-
* API can be used to configure a WebHook on your LoginRadius site. Webhooks also work on subscribe and notification model, subscribe your hook and get a notification. Equivalent to RESThook but these provide security on basis of signature and RESThook work on unique URL. Following are the events that are allowed by LoginRadius to trigger a WebHook service call.
44+
* This API is used to create a new webhook subscription on your LoginRadius site.
4945
* @param webHookSubscribeModel Model Class containing Definition of payload for Webhook Subscribe API
50-
* @return Response containing Definition of Complete Validation data
46+
* @return Response containing Definition for Complete WebHook data
5147
* 40.2
5248
*/
5349

54-
public function webHookSubscribe($webHookSubscribeModel)
50+
public function createWebhookSubscription($webHookSubscribeModel)
5551
{
56-
$resourcePath = "/api/v2/webhook";
52+
$resourcePath = "/v2/manage/webhooks";
5753
$queryParam = [];
5854
$queryParam['apikey'] = Functions::getApiKey();
5955
$queryParam['apisecret'] = Functions::getApiSecret();
@@ -63,36 +59,72 @@ public function webHookSubscribe($webHookSubscribeModel)
6359

6460

6561
/**
66-
* API can be used to test a subscribed WebHook.
67-
* @return Response containing Definition of Complete Validation data
62+
* This API is used to delete webhook subscription
63+
* @param hookId Unique ID of the webhook
64+
* @return Response containing Definition of Delete Request
6865
* 40.3
6966
*/
7067

71-
public function webhookTest()
68+
public function deleteWebhookSubscription($hookId)
7269
{
73-
$resourcePath = "/api/v2/webhook/test";
70+
$resourcePath = "/v2/manage/webhooks/$hookId";
7471
$queryParam = [];
7572
$queryParam['apikey'] = Functions::getApiKey();
7673
$queryParam['apisecret'] = Functions::getApiSecret();
77-
return Functions::_apiClientHandler('GET', $resourcePath, $queryParam);
74+
return Functions::_apiClientHandler('DELETE', $resourcePath, $queryParam);
7875
}
7976

8077

8178

8279
/**
83-
* API can be used to unsubscribe a WebHook configured on your LoginRadius site.
84-
* @param webHookSubscribeModel Model Class containing Definition of payload for Webhook Subscribe API
85-
* @return Response containing Definition of Delete Request
80+
* This API is used to update a webhook subscription
81+
* @param hookId Unique ID of the webhook
82+
* @param webHookSubscriptionUpdateModel Model Class containing Definition for WebHookSubscriptionUpdateModel Property
83+
* @return Response containing Definition for Complete WebHook data
8684
* 40.4
8785
*/
8886

89-
public function webHookUnsubscribe($webHookSubscribeModel)
87+
public function updateWebhookSubscription($hookId, $webHookSubscriptionUpdateModel)
88+
{
89+
$resourcePath = "/v2/manage/webhooks/$hookId";
90+
$queryParam = [];
91+
$queryParam['apikey'] = Functions::getApiKey();
92+
$queryParam['apisecret'] = Functions::getApiSecret();
93+
return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, $webHookSubscriptionUpdateModel);
94+
}
95+
96+
97+
98+
/**
99+
* This API is used to get the list of all the webhooks
100+
* @return Response Containing List of Webhhook Data
101+
* 40.5
102+
*/
103+
104+
public function listAllWebhooks()
90105
{
91-
$resourcePath = "/api/v2/webhook";
106+
$resourcePath = "/v2/manage/webhooks";
92107
$queryParam = [];
93108
$queryParam['apikey'] = Functions::getApiKey();
94109
$queryParam['apisecret'] = Functions::getApiSecret();
95-
return Functions::_apiClientHandler('DELETE', $resourcePath, $queryParam, $webHookSubscribeModel);
110+
return Functions::_apiClientHandler('GET', $resourcePath, $queryParam);
111+
}
112+
113+
114+
115+
/**
116+
* This API is used to retrieve all the webhook events.
117+
* @return Model Class containing Definition for WebHookEventModel Property
118+
* 40.6
119+
*/
120+
121+
public function getWebhookEvents()
122+
{
123+
$resourcePath = "/v2/manage/webhooks/events";
124+
$queryParam = [];
125+
$queryParam['apikey'] = Functions::getApiKey();
126+
$queryParam['apisecret'] = Functions::getApiSecret();
127+
return Functions::_apiClientHandler('GET', $resourcePath, $queryParam);
96128
}
97129

98130
}

src/LoginRadiusSDK/Utility/Functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class Functions
2323
{
2424

25-
const VERSION = '11.6.0';
25+
const VERSION = '11.7.0';
2626

2727
private static $_apikey;
2828
private static $_apisecret;

0 commit comments

Comments
 (0)