Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #2

Merged
merged 3 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 4

[docker-compose.yml]
indent_size = 4
44 changes: 44 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Tests

on:
push:

permissions:
contents: read

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [ 8.3 ]

name: PHP ${{ matrix.php }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom
coverage: pcov

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Run Tests & Generate Code Coverage Report
run: vendor/bin/phpunit --coverage-clover 'coverage.xml'

- name: Publish Code Coverage
uses: paambaati/[email protected]
if: ${{ github.ref == 'refs/heads/master' }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{ github.workspace }}/coverage.xml:clover
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/vendor
/.idea
/reports
/phpunit.xml
.phpunit.result.cache
.DS_Store
49 changes: 49 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
php:
preset: laravel

enabled:
- align_double_arrow
- align_equals
- assign_null_coalescing_to_coalesce_equal
- boolean_operator_linebreak_beginning
- combine_consecutive_issets
- combine_consecutive_unsets
- concat_with_spaces
- const_visibility_required
- empty_loop_body_semicolon
- empty_loop_condition
- explicit_indirect_variable
- explicit_string_variable
- linebreak_after_opening_tag
- method_chaining_indentation
- multiline_comment_opening_closing
- no_blank_lines_between_traits
- nullable_type_declarations
- ordered_class_elements
- php_unit_fqcn_annotation
- php_unit_internal_class
- php_unit_test_case_self_method_calls
- php_unit_test_class_requires_covers
- phpdoc_add_missing_param_annotation
- phpdoc_inline_inheritdoc
- phpdoc_link_to_see
- phpdoc_trim_consecutive_blank_line_separation
- phpdoc_var_order
- property_separation
- protected_to_private
- semicolon_after_instruction
- simplified_if_return
- single_space_after_construct
- standardize_increment

disabled:
- unalign_equals
- concat_without_spaces
- not_operator_with_successor_space
- trailing_comma_in_multiline_array
- phpdoc_summary
- laravel_braces
- no_unused_imports

js: false
css: false
342 changes: 141 additions & 201 deletions LICENSE

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Laravel AWS SNS Listener

Copyright Sine Macula Limited. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
62 changes: 60 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,60 @@
# laravel-aws-sns-listener
A Laravel package to handle AWS SNS notifications, providing seamless integration and event handling for your Laravel applications.
# Laravel AWS SNS Listener

[![Latest Stable Version](https://img.shields.io/packagist/v/sinemacula/laravel-aws-sns-listener.svg)](https://packagist.org/packages/sinemacula/laravel-aws-sns-listener)
[![Build Status](https://github.com/sinemacula/laravel-aws-sns-listener/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/sinemacula/laravel-aws-sns-listener/actions/workflows/tests.yml)
[![StyleCI](https://github.styleci.io/repos/839572387/shield?style=flat&branch=master)](https://github.styleci.io/repos/839572387)
[![Maintainability](https://api.codeclimate.com/v1/badges/1471641388c9d7481777/maintainability)](https://codeclimate.com/github/sinemacula/laravel-aws-sns-listener/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/1471641388c9d7481777/test_coverage)](https://codeclimate.com/github/sinemacula/laravel-aws-sns-listener/test_coverage)
[![Total Downloads](https://img.shields.io/packagist/dt/sinemacula/laravel-aws-sns-listener.svg)](https://packagist.org/packages/sinemacula/laravel-aws-sns-listener)

The Laravel AWS SNS Listener is a comprehensive package designed to handle AWS SNS notifications in Laravel
applications. It provides tools to easily configure SNS subscriptions, process notifications, and trigger Laravel
events, making integration with AWS SNS seamless and efficient.

## Features

- **Subscription Confirmation**: Automatically handles AWS SNS subscription confirmations to ensure secure and expected
subscriptions.
- **Event Handling**: Triggers native Laravel events when SNS notifications are received, allowing for flexible and
extensible handling of different notification types.
- **Configurable Routes**: Easily configure the route for receiving SNS notifications, providing flexibility in routing
and security.
- **Expected Topics**: Maintain a list of expected SNS topics to ensure only legitimate subscriptions are accepted.

## Installation

To install the Laravel AWS SNS Listener, run the following command in your project directory:

```bash
composer require sinemacula/laravel-aws-sns-listener
```

## Configuration

After installation, publish the package configuration to customize it according to your needs:

```bash
php artisan vendor:publish --provider="SineMacula\Aws\Sns\SnsServiceProvider"
```

This command publishes the package configuration file to your application's config directory, allowing you to modify
aspects such as the SNS route and expected topics.

## Usage

Detailed usage instructions will be provided soon. This section will cover how to integrate the listener into your
Laravel application, including setting up the route for SNS notifications, handling subscription confirmations, and
registering event listeners.

## Contributing

Contributions are welcome and will be fully credited. We accept contributions via pull requests on GitHub.

## Security

If you discover any security related issues, please email instead of using the issue tracker.

## License

The Laravel AWS SNS Listener repository is open-sourced software licensed under
the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
54 changes: 54 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "sinemacula/laravel-aws-sns-listener",
"type": "library",
"description": "Laravel package to handle AWS SNS notifications with seamless integration and event-driven architecture",
"keywords": [
"sine macula",
"laravel",
"aws",
"sns",
"listener",
"events",
"webhooks"
],
"license": "Apache-2.0",
"authors": [
{
"name": "Ben Carey",
"email": "[email protected]"
}
],
"require": {
"php": "^8.3",
"aws/aws-php-sns-message-validator": "^1.9",
"aws/aws-sdk-php": "^3.319",
"illuminate/http": "^11.0",
"illuminate/support": "^11.0",
"nesbot/carbon": "^3.7"
},
"require-dev": {
"phpunit/phpunit": "^11.0"
},
"autoload": {
"psr-4": {
"SineMacula\\Aws\\Sns\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"laravel": {
"providers": [
"SineMacula\\Aws\\Sns\\SnsServiceProvider"
]
}
}
}
Loading
Loading