renoki-co / laravel-aws-webhooks Goto Github PK
View Code? Open in Web Editor NEWEasy webhook handler for Laravel to catch AWS SNS notifications for various services.
License: Apache License 2.0
Easy webhook handler for Laravel to catch AWS SNS notifications for various services.
License: Apache License 2.0
Hi there ๐
First, thanks for building such a lovely package. It saves me so much time when adding SES/SNS to new apps.
I'm currently adding the package to an app, where I would like to test my webhook handle methods. I've seen that you have a GeneratesSnsMessages
-trait for your own tests to quickly generate the payload.
I've now copy/pasted the trait into my own app to make testing easier. Works great! My tests are straightforward and easy to read.
/** @test */
public function it_logs_aws_sns_ses_webhook_event_for_complaint_event_and_updates_timestamp()
{
$send = Send::factory()->create();
$payload = $this->getNotificationPayload([
'eventType' => 'Complaint',
'mail' => [
'messageId' => $send->transport_message_id,
],
]);
$response = $this->makeHttpRequestToController($payload);
$response->assertOk();
$this->assertNotNull($send->refresh()->complained_at);
}
Would you be open for a PR, which would move the GeneratesSnsMessages
-trait to the src
-folder?
As the test
-folder is only autoloaded in development, I can't use your GeneratesSnsMessages
-trait directly as a package consumer.
I also had to overwrite the getMessageValidator
-message in my Controller (like in your tests).
Maybe this could also be solved with a app()->environment('testing')
if-condition?
Currently this package requires laravel/framework
as a dependency, this makes it import the entire Laravel Framework and thus makes it impossible to use the package in (for example) Lumen or in a custom project that leverages only some of the Laravel components.
I wonder if it would be possible to make the package depend on the specific illuminate/...
packages instead, a quick source search shows me the following packages are used:
illuminate/http
illuminate/support
The same would apply to the rennokki/laravel-sns-events
package, here the dependency list could be reduced to:
illuminate/http
illuminate/routing
illuminate/support
For development/testing purposes the orchestra/testbench
package will in turn require the illuminate/framework
, thus making it available/usable during dev and testing without having to require it as a regular dependency.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.