GithubHelp home page GithubHelp logo

renoki-co / laravel-aws-webhooks Goto Github PK

View Code? Open in Web Editor NEW
69.0 4.0 15.0 122 KB

Easy webhook handler for Laravel to catch AWS SNS notifications for various services.

License: Apache License 2.0

PHP 100.00%
aws webhooks sns cloudwatch laravel php package controller laravel-aws-webhooks sns-topic sns-notifications hacktoberfest

laravel-aws-webhooks's Issues

Question: Make `GeneratesSnsMessages` a public trait?

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?

[Enhancement] Require specific (laravel) packages instead of laravel/framework

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.