File tree Expand file tree Collapse file tree 7 files changed +108
-35
lines changed Expand file tree Collapse file tree 7 files changed +108
-35
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,5 @@ APPLICATION_ID=635c2797-9295-4cdf-9232-d275f75ff096
44PRIVATE_KEY=private.key
55FROM=
66TO_NUMBER=
7-
8- # Number Insight building blocks
7+ NEXMO_SECRET_ID=
98INSIGHT_NUMBER=
Original file line number Diff line number Diff line change @@ -35,18 +35,25 @@ For some of the examples you will need to [buy a number](https://dashboard.nexmo
3535
3636| Code Sample |
3737| ---------------------------------------- |
38- | Send Phone Verification Code | [ verify/request.php] |
39- | Check Phone Verification Code | [ verify/verify.php] |
40- | Cancel Phone Verification | [ verify/cancel.php] |
38+ | [ Send Phone Verification Code] ( verify/request.php ) |
39+ | [ Check Phone Verification Code] ( verify/verify.php ) |
40+ | [ Cancel Phone Verification] ( verify/cancel.php ) |
4141
42+ ### Secret Management
4243
44+ | Code Sample |
45+ | ---------------------------------------- |
46+ | [ List Secrets] ( secret-management/fetch-secrets.php ) |
47+ | [ Get a Secret] ( secret-management/get-a-secret.php ) |
48+ | [ Create a Secret] ( secret-management/create-a-secret.php ) |
49+ | [ Delete a Secret] ( secret-management/delete-a-secret.php ) |
4350
4451## Request More Examples
4552
4653Please [ raise an issue] ( /../../issues/ ) to request an example that isn't present within the quickstart. Pull requests will be gratefully received.
4754
4855## Licenses
4956
50- - The code samples in this repo is under [ MIT] ( LICENSE )
57+ - The sample code in this repo is licensed under [ MIT] ( LICENSE )
5158
52-
59+
Original file line number Diff line number Diff line change 1+ <?php
2+ require_once __DIR__ . '/../config.php ' ;
3+ require_once __DIR__ . '/../vendor/autoload.php ' ;
4+
5+ $ basic = new \Nexmo \Client \Credentials \Basic ($ _ENV ['NEXMO_API_KEY ' ], $ _ENV ['NEXMO_API_SECRET ' ]);
6+ $ client = new \Nexmo \Client ($ basic );
7+
8+ // set an environment variable API_KEY to work with secrets for a secondary key
9+ $ api_key = isset ($ _ENV ['API_KEY ' ]) ? $ _ENV ['API_KEY ' ] : $ _ENV ['NEXMO_API_KEY ' ];
10+ $ secret = 'awes0meNewSekret!!; ' ;
11+
12+ $ client ->account ()->createSecret ($ api_key , $ secret );
13+
Original file line number Diff line number Diff line change 1+ <?php
2+ require_once __DIR__ . '/../config.php ' ;
3+ require_once __DIR__ . '/../vendor/autoload.php ' ;
4+
5+ $ basic = new \Nexmo \Client \Credentials \Basic ($ _ENV ['NEXMO_API_KEY ' ], $ _ENV ['NEXMO_API_SECRET ' ]);
6+ $ client = new \Nexmo \Client ($ basic );
7+
8+ // set an environment variable API_KEY to work with secrets for a secondary key
9+ $ api_key = isset ($ _ENV ['API_KEY ' ]) ? $ _ENV ['API_KEY ' ] : $ _ENV ['NEXMO_API_KEY ' ];
10+
11+ try {
12+ $ response = $ client ->account ()->deleteSecret ($ api_key , $ _ENV ['NEXMO_SECRET_ID ' ]);
13+ echo "OK \n" ;
14+ } catch (\Nexmo \Client \Exception \Request $ e ) {
15+ echo $ e ->getMessage ();
16+ }
17+
Original file line number Diff line number Diff line change 1+ <?php
2+ require_once __DIR__ . '/../config.php ' ;
3+ require_once __DIR__ . '/../vendor/autoload.php ' ;
4+
5+ $ basic = new \Nexmo \Client \Credentials \Basic ($ _ENV ['NEXMO_API_KEY ' ], $ _ENV ['NEXMO_API_SECRET ' ]);
6+ $ client = new \Nexmo \Client ($ basic );
7+
8+ // set an environment variable API_KEY to work with secrets for a secondary key
9+ $ api_key = isset ($ _ENV ['API_KEY ' ]) ? $ _ENV ['API_KEY ' ] : $ _ENV ['NEXMO_API_KEY ' ];
10+
11+ $ response = $ client ->account ()->listSecrets ($ api_key );
12+ foreach ($ response ['secrets ' ] as $ secret ) {
13+ echo "ID: " . $ secret ['id ' ] . " (created " . $ secret ['created_at ' ] .") \n" ;
14+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ require_once __DIR__ . '/../config.php ' ;
3+ require_once __DIR__ . '/../vendor/autoload.php ' ;
4+
5+ $ basic = new \Nexmo \Client \Credentials \Basic ($ _ENV ['NEXMO_API_KEY ' ], $ _ENV ['NEXMO_API_SECRET ' ]);
6+ $ client = new \Nexmo \Client ($ basic );
7+
8+ // set an environment variable API_KEY to work with secrets for a secondary key
9+ $ api_key = isset ($ _ENV ['API_KEY ' ]) ? $ _ENV ['API_KEY ' ] : $ _ENV ['NEXMO_API_KEY ' ];
10+
11+ $ secret = $ client ->account ()->getSecret ($ api_key , $ _ENV ['NEXMO_SECRET_ID ' ]);
12+ echo "ID: " . $ secret ['id ' ] . " (created " . $ secret ['created_at ' ] .") \n" ;
You can’t perform that action at this time.
0 commit comments