You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-8Lines changed: 37 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,12 @@
1
1
# LiveKit Server API for PHP
2
2
3
-
PHP APIs to manage rooms and to create access tokens. This library is designed to work with [livekit-server](https://github.com/livekit/livekit-server). Use it with a PHP backend to manage access to LiveKit.
3
+
Use this SDK to interact with [livekit](https://github.com/livekit/livekit-server) server APIs and create access tokens from your PHP Backend.
You may store credentials in environment variables. If host, api-key or api-secret is not passed in when creating a RoomServiceClient or AccessToken, the values in the following env vars will be used:
20
22
21
23
- LIVEKIT_URL
@@ -47,13 +49,14 @@ $videoGrant = (new VideoGrant())
47
49
->setRoomJoin();
48
50
->setRoomName($roomName);
49
51
50
-
// Initialize and fetch the JWT Token.
52
+
// Initialize and fetch the JWT Token.
51
53
$token = (new AccessToken('api-key', 'secret-key'))
52
54
->init($tokenOptions)
53
55
->setGrant($videoGrant)
54
56
->toJwt();
55
57
56
58
```
59
+
57
60
By default, the token expires after 6 hours. you may override this by passing in `ttl` in the access token options. `ttl` is expressed in seconds (as number) .
58
61
59
62
### Parsing the Access Tokens
@@ -63,8 +66,8 @@ Converting the JWT Token into a ClaimGrants.
63
66
```php
64
67
use Agence104\LiveKit\AccessToken;
65
68
66
-
// Initialize and parse the JWT Token.
67
-
$claimGrants = (new AccessToken('api-key', 'secret-key'))
69
+
// Initialize and parse the JWT Token.
70
+
$claimGrants = (new AccessToken('api-key', 'secret-key'))
68
71
->fromJwt($token);
69
72
```
70
73
@@ -111,38 +114,64 @@ $svc->deleteRoom('myroom');
111
114
```
112
115
113
116
### Running Tests
114
-
We'll utilize Lando to streamline the test execution process. However, should you choose to run the tests on your local
117
+
118
+
We'll utilize Lando to streamline the test execution process. However, should you choose to run the tests on your local
115
119
environment directly, you can certainly proceed with that approach.
116
120
117
-
#### Step 1:
118
-
Generate your environment file by duplicating `example.dev` and renaming the copy to `.env`, then enter your credentials
121
+
#### Step 1:
122
+
123
+
Generate your environment file by duplicating `example.dev` and renaming the copy to `.env`, then enter your credentials
119
124
accordingly.
120
125
121
126
### Step 2:
127
+
122
128
Start the lando project.
129
+
123
130
```
124
131
lando start
125
132
```
126
133
127
134
#### Step 3:
135
+
128
136
Generate the LiveKit room that will serve as the testing environment for the majority of the test cases.
137
+
129
138
```
130
139
lando create-test-room
131
140
```
132
141
133
142
#### Step 4:
143
+
134
144
Initialize 5 test users within the room. Run this command in a separate terminal window.
145
+
135
146
```
136
147
lando start-test-users
137
148
```
138
149
139
150
#### Step 5:
151
+
140
152
Time to get busy testing.
153
+
141
154
```
142
155
lando test
143
156
```
144
157
145
158
#### Step 6:
159
+
146
160
Once tests are completed, it is time to clean up.
161
+
147
162
- End the `lando start-test-users` command.
148
163
- Run `lando delete-test-room` to delete the test room.
0 commit comments