If you want to test your twilio/sdk by using Twilio API fake response, you can use this package to make it.
- PHP >= 7.4;
- composer.
composer require onramplab/php-twilio-enhancement
- Able to log Twilio API response
- Able to mock API response for testing
You can check out this document: Call the Twilio REST API with a custom TwilioRestClient in PHP.
Example code for Laravel:
use Onramplab\TwilioEnhancement\CurlClient;
use Psr\Log\LoggerInterface;
use Twilio\Rest\Client;
$logger = app()->make(LoggerInterface::class);
$httpClient = new CurlClient([], $logger);
$twilio = new Client($sid, $token, null, null, $httpClient);
- PSR-4 autoloading compliant structure;
- PSR-2 compliant code style;
- Unit-Testing with PHPUnit 6;
- Comprehensive guide and tutorial;
- Easy to use with any framework or even a plain php file;
- Useful tools for better code included.
php vendor/bin/phpunit
or
composer test
php vendor/bin/phpcs --standard=PSR2 src/
or
composer psr2check
composer psr2autofix
composer insights:fix
rector:fix
php vendor/bin/phpdoc -d "src" -t "docs"
or
composer docs
To keep track, please refer to CHANGELOG.md.
- Fork it.
- Create your feature branch (git checkout -b my-new-feature).
- Make your changes.
- Run the tests, adding new ones for your own code if necessary (phpunit).
- Commit your changes (git commit -am 'Added some feature').
- Push to the branch (git push origin my-new-feature).
- Create new pull request.
Also please refer to CONTRIBUTION.md.
Please refer to LICENSE.