Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
49ff30d
chore: release candidate and pre-release setup
isha689 Nov 7, 2022
9e6bdce
chore: create BaseClient in Base folder (#751)
rohith-prakash Nov 21, 2022
7070cc5
fix: Add Cluster test (#755)
rohith-prakash Dec 30, 2022
fc32a52
docs: updated the year in the license
Jan 3, 2023
ae42b22
chore: add rc installation instructions
isha689 Jan 9, 2023
07fcbb5
fix: add handcrafted domain files with deprecated message for shortcu…
rohith-prakash Jan 9, 2023
67a4a46
fix: base file name (#757)
isha689 Jan 9, 2023
595b13c
chore: removing Integration test suite
isha689 Jan 10, 2023
2164fe1
chore: sync up with main branch (#758)
isha689 Jan 11, 2023
c9204f5
Delete tests/Twilio/Unit/TwiML/Voice directory
isha689 Jan 11, 2023
47e213f
chore: delete voiceResponseTest.php
isha689 Jan 11, 2023
1a24970
[Librarian] Regenerated @ 82775d167bff9b55d1399fe288c2934a02411e8c
twilio-dx Jan 11, 2023
dba6c04
Release 7.0.0-rc.1
twilio-dx Jan 11, 2023
e02beca
fix: support array parameters for Guzzle GETs (#759)
isha689 Jan 14, 2023
b8cb9fd
fix: type hint for $capabilities to PhoneNumberCapabilities (#760)
isha689 Jan 24, 2023
012ea1f
chore: remove code smells (#762)
isha689 Jan 24, 2023
246cba9
[Librarian] Regenerated @ a72b955e51d75514f3c944c81b9db17278cfad69
twilio-dx Jan 25, 2023
e8f1265
[Librarian] Regenerated @ b8981cc124150c7112387152deb5f97fb9a25d66
twilio-dx Jan 27, 2023
c8cb558
chore: add examples for calling common apis (#763)
isha689 Jan 30, 2023
73e0e1e
fix: correct version (#765)
isha689 Jan 31, 2023
4678643
fix: drop removed APIs (#766)
isha689 Feb 1, 2023
ebfeea4
fix: correct default values for different data types (#768)
isha689 Feb 7, 2023
8f155d5
fix: correct indentation and camelCase version (#767)
isha689 Feb 7, 2023
7a28028
fix: test failures for PhpUnit >=10 (#769)
isha689 Feb 8, 2023
2f45738
[Librarian] Regenerated @ 6112a581d3189fe96d26eb29eb9adfdbd1c2ada5
twilio-dx Feb 8, 2023
647a89c
Release 7.0.0-rc.3
twilio-dx Feb 8, 2023
3e6928a
[Librarian] Regenerated @ 17e62aff1baa8b949ed63e888ff63c1da8945fe5
twilio-dx Feb 22, 2023
9b2f4c8
Release 7.0.0-rc.4
twilio-dx Feb 22, 2023
2a254dd
chore: update upgrade guilde and contribution summary (#764)
isha689 Mar 6, 2023
32c62ef
chore: remove RC changes from Changes.md and Readme.md
charan678 Mar 6, 2023
ba9ba84
chore: update changes file
charan678 Mar 6, 2023
5452353
Merge branch 'main' into rc-to-main
charan678 Mar 6, 2023
605c4f4
chore: remove newly added integration tests
charan678 Mar 6, 2023
9f7bf69
chore: remove .open-generator folders/files
charan678 Mar 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 10 additions & 1 deletion .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ jobs:
if [ -f "coverage.xml" ]; then
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
fi
- name: Run Cluster Test
if: (!github.event.pull_request.head.repo.fork)
env:
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
TWILIO_API_KEY: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY}}
TWILIO_API_SECRET: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY_SECRET }}
TWILIO_FROM_NUMBER: ${{ secrets.TWILIO_FROM_NUMBER }}
TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }}
run: make cluster-test

- name: Install SonarCloud scanner and run analysis
uses: SonarSource/sonarcloud-github-action@master
Expand Down Expand Up @@ -110,4 +119,4 @@ jobs:
SLACK_MSG_AUTHOR: twilio-dx
SLACK_FOOTER: Posted automatically using GitHub Actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true
MSG_MINIMAL: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ nbproject

# This is used by the documentation generator
venv
**/.openapi-generator*
**/.openapi-generator-ignore*
16 changes: 14 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,20 @@ This code was generated by
"""
```
then it is a generated file and the change will need to be made by us, but
submitting an issue will help us track it and keep you up-to-date. If the file
isn't generated, you can help us out even more by submitting a Pull Request with
submitting an issue will help us track it and keep you up-to-date.

If the file has this header:
```
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
```
then this is a generated file,
you can help us out by submitting a Pull Request to the [twilio-oai-generator](https://github.com/twilio/twilio-oai-generator).

If the file isn't generated, you can help us out even more by submitting a Pull Request with
a fix.

**Please see the [Submission Guidelines](#submit) below.**
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ docker-dev-clean:

docker-dev-test:
docker exec -t twilio_php${VERSION} /bin/bash -c 'make all'

cluster-test:
@PATH=vendor/bin:$(PATH) phpunit --filter ClusterTest tests/Twilio/ClusterTest.php
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

_MAJOR version bumps will have upgrade notes posted here._

[2023-03-08] 6.x.x to 7.x.x
---------------------------
Twilio Php Helper Library’s major version 7.0.1 is now available. We ensured that you can upgrade to Php helper Library 7.0.1 version without any breaking changes.
Behind the scenes Php Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages.

To learn more about the Php Helper Library, check out [our docs](https://www.twilio.com/docs/libraries/php).

[2020-04-15] 6.2.x to 6.3.x
---------------------------
### CHANGED - Optional header parameters added to `Authy` endpoints
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
},
"autoload-dev": {
"psr-4": {
"": "src/Twilio/",
"Twilio\\Tests\\": "tests/Twilio/"
}
},
"config": {
"lock": false
}
}
}
34 changes: 34 additions & 0 deletions example/call.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');

use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

// The phone number, SIP address, Client identifier or SIM SID that received this call.
// Phone numbers are in [E.164 format](https://www.twilio.com/docs/glossary/what-e164) (e.g., +16175551212).
// SIP addresses are formatted as [email protected].
// Client identifiers are formatted client:name.
// SIM SIDs are formatted as sim:sid
$to = "+XXXXXXXXXX";

// The phone number or client identifier to use as the caller id.
// If using a phone number, it must be a Twilio number or a Verified outgoing caller id for your account.
// If the "to" parameter is a phone number, "from" must also be a phone number.
$from = "+XXXXXXXXXX";

// Make a phone call
$call = $client->calls->create(
$to,
$from,
["url" => "https://twilio.com"]
);
print("Call made successfully with sid: ".$call->sid."\n\n");

// Get some calls
$callsList = $client->calls->read([],null,2);
foreach ($callsList as $call) {
print("Call {$call->sid}: {$call->duration} seconds\n");
}
29 changes: 29 additions & 0 deletions example/incomingPhoneNumber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');

use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

function buyNumber(): ?Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberInstance{
// Look up some phone numbers
global $client;

// Specify the [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the country
// from which to read phone numbers, eg: "US"
$numbers = $client->availablePhoneNumbers("XX")->local->read();

// Buy the first phone number
if(!empty($numbers)){
$local = $numbers[0];
return $client->incomingPhoneNumbers->create(["phoneNumber" => $local->phoneNumber]);
}

return null;
}

// Get a number
$number = buyNumber();
print("Twilio purchased phoneNumber: ".$number->phoneNumber."\n");
31 changes: 31 additions & 0 deletions example/message.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');

use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

// Specify the phone numbers in [E.164 format](https://www.twilio.com/docs/glossary/what-e164) (e.g., +16175551212)
// This parameter determines the destination phone number for your SMS message. Format this number with a '+' and a country code
$phoneNumber = "+XXXXXXXXXX";

// This must be a Twilio phone number that you own, formatted with a '+' and country code
$twilioPurchasedNumber = "+XXXXXXXXXX";

// Send a text message
$message = $client->messages->create(
$phoneNumber,
[
'from' => $twilioPurchasedNumber,
'body' => "Hey Jenny! Good luck on the bar exam!"
]
);
print("Message sent successfully with sid = " . $message->sid ."\n\n");

// Print the last 10 messages
$messageList = $client->messages->read([],10);
foreach ($messageList as $msg) {
print("ID:: ". $msg->sid . " | " . "From:: " . $msg->from . " | " . "TO:: " . $msg->to . " | " . " Status:: " . $msg->status . " | " . " Body:: ". $msg->body ."\n");
}
14 changes: 14 additions & 0 deletions example/record.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');

use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

// Get last 10 records
$recordList = $client->usage->records->read([], 10);
foreach ($recordList as $record) {
print_r("Record(accountSid=" . $record->accountSid . ", apiVersion=" . $record->apiVersion . ", asOf=" . $record->asOf . ", category=" . $record->category . ", count=" . $record->count . ", countUnit=" . $record->countUnit . ", description=" . $record->description . ", endDate=" . $record->endDate->format("Y-m-d H:i:s") . ", price=" . $record->price . ", priceUnit=" . $record->priceUnit . ", startDate=" . $record->startDate->format("Y-m-d H:i:s") . ", uri=" . $record->uri . ", usage=" . $record->usage . ", usageUnit=" . $record->usageUnit . "\n");
}
27 changes: 27 additions & 0 deletions example/signingKey.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');
require(__DIR__.'/../vendor/autoload.php');
use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

// Create new Signing Key
$signingKey = $client->api->v2010->newSigningKeys->create();

// Switch to guzzle client as the default client
$guzzleClient = new Client($signingKey->sid, $signingKey->secret, $sid, null, new \Twilio\Http\GuzzleClient(new \GuzzleHttp\Client));

// The phone number you are querying in E.164 or national format.
// If the phone number is provided in national format, please also specify the country in the optional parameter CountryCode.
// Otherwise, CountryCode will default to US.
$number = "+XXXXXXXXXX";

// Make REST API requests
$phone_number = $guzzleClient->lookups->v1->phoneNumbers($number)
->fetch([
"type" => ["carrier"]
]);

print_r($phone_number->carrier);
17 changes: 17 additions & 0 deletions example/trunk.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');

use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

// Create Trunk
$trunk = $client->trunking->v1->trunks->create(
[
"friendlyName" => "shiny trunk",
"secure" => false
]
);
print("\n".$trunk."\n");
43 changes: 43 additions & 0 deletions example/twiML.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
require(__DIR__ . '/../vendor/autoload.php');

use Twilio\TwiML\VoiceResponse;

// TwiML Say and Play
$say = new \Twilio\TwiML\Voice\Say('Hello World!', [
'voice' => 'woman'
]);

$play = new \Twilio\TwiML\Voice\Play("https://api.twilio.com/cowbell.mp3", [
'loop' => 5
]);

$twiml = new VoiceResponse();
$twiml->append($say);
$twiml->append($play);

print("TwiML Say and Play: \n{$twiml->asXML()}\n");


// Gather, Redirect
$twimlResponse = new VoiceResponse();
$gather = $twimlResponse->gather();
$gather->setNumDigits(10);
$gather->say("Press 1");
$twimlResponse->redirect("https://example.com");
print("TwiML Gather and Redirect: \n{$twimlResponse->asXML()}\n");


// Dial
$twimlResponse = new VoiceResponse();

// A valid phone number formatted with a '+' and a country code (e.g., +16175551212)
$callerID = '+XXXXXXXX';
$dial = $twimlResponse->dial('', [
'callerId' => $callerID,
'action' => 'https:///example.com',
'hangupOnStar' => true,
]);

$dial->conference("My Room", ["beep" => "true"]);
print("TwiML Dial: \n{$twimlResponse->asXML()}\n");
Loading