Download the PHP package andreshg112/aws-sns without Composer

On this page you can find all versions of the php package andreshg112/aws-sns. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package aws-sns

Amazon SNS Notifications Channel for Laravel 6

Latest Version on Packagist Build Status Quality Score Code Coverage Total Downloads

This package makes it easy to send notifications using Amazon SNS with Laravel 5.3.

Contents

Installation

Can to install with commands:

composer require lab123/aws-sns:dev-master

Or editing the composer.json file:

"require": {
    "lab123/aws-sns": "dev-master"
}

You must install the service provider.

Laravel 5.x

configure in config/app.php:

'providers' => [
    ...
    Lab123\AwsSns\AwsSnsServiceProvider::class,
]

Lumen 5.x

configure in bootstrap/app.php:

$app->register(\Lab123\AwsSns\AwsSnsLumenServiceProvider::class);

Note: You go need make a wrapper Laravel Notification or use a package how Lumen Notification

Setting up the AwsSns service

Follow the Amazon Console generate the APIKEY and API SECRET, which is connecting both.

Create a new sns section inside config/services.php:

...
'sns' => [
    'key' => env('SNS_KEY'),
    'secret' => env('SNS_SECRET'),
    'region' => env('SNS_REGION', 'us-east-1')
],
...

Next we need to add this keys to our Laravel environment. Edit file .env to config the keys:

...
SNS_KEY=YOUR_KEY
SNS_SECRET=YOUR_SECRET
SNS_REGION=YOUR_REGION
...

Default Configurations SMS (OPTIONAL)

You also can config defaults attributes for sending SMS running php artisan vendor:publish --provider="Lab123\AwsSns\AwsSnsServiceProvider" or creating file config/aws-sns.php:

return [

    'sms' => [
        'monthlySpendLimit' => env('SNS_SMS_MONTHLY_LIMIT'),
        'deliveryStatusIAMRole' => env('SNS_SMS_DELIVERY_STATUS_IAM_ROLE'),
        'deliveryStatusSuccessSamplingRate' => env('SNS_SMS_DELIVERY_STATUS'),
        'defaultSenderID' => env('SNS_SMS_SENDER'),
        'defaultSMSType' => env('SNS_SMS_TYPE'),
        'usageReportS3Bucket' => env('SNS_SMS_REPORT_S3')
    ]
]

And now you can set your default configuration for SMS in .env

Note: More information how they work the settings at http://docs.aws.amazon.com/en/sns/latest/api/API_SetSMSAttributes.html

Usage

Sending SMS

To send sms without the need to create a topic, leave the function via as follows:

// Notifications/Welcome.php
/**
 * Get the notification channels.
 *
 * @param mixed $notifiable
 * @return array|string
 */
public function via($notifiable)
{
    return [
        AwsSnsSmsChannel::class
    ];
}

Add function toAwsSnsSms() expected by class AwsSnsSmsChannel to send notification:

// Notifications/Welcome.php
/**
 * Get the AWS SNS SMS Message representation of the notification.
 *
 * @param mixed $notifiable
 * @return \Lab123\AwsSns\Messages\AwsSnsMessage
 */
public function toAwsSnsSms($notifiable)
{
    return (new AwsSnsMessage())->message('Message Here')->phoneNumber('+5511999999999');
}

You also can ignore the ->phoneNumber() in your notification and use function routeNotificationForAwsSnsSms in your Model Notifiable:

// Models/User.php
/**
 * Route notifications for the Aws SNS SMS channel.
 *
 * @return string
 */
public function routeNotificationForAwsSnsSms()
{
    return $this->phone_number;
}

Note.: The expected number use the standards-based international E.123

eg.: +5511999999999

Sending Topic

To send notification to a topic, leave the function via as follows:

// Notifications/Welcome.php
/**
 * Get the notification channels.
 *
 * @param mixed $notifiable
 * @return array|string
 */
public function via($notifiable)
{
    return [
        AwsSnsTopicChannel::class
    ];
}

Add function toAwsSnsTopic() expected by class AwsSnsTopicChannel to send notification:

// Notifications/Welcome.php
/**
 * Get the AWS SNS Topic Message representation of the notification.
 *
 * @param mixed $notifiable
 * @return \Lab123\AwsSns\Messages\AwsSnsMessage
 */
public function toAwsSnsTopic($notifiable)
{
    return (new AwsSnsMessage())->message('Message Here')->topicArn('arn:aws:sns:us-east-1:000000000000:name-topic');
}

You also can ignore the ->topicArn() in your notification and use function routeNotificationForAwsSnsTopic in your Model Notifiable:

// Models/User.php
/**
 * Route notifications for the Aws SNS Topic channel.
 *
 * @return string
 */
public function routeNotificationForAwsSnsTopic()
{
    return $this->topicArn;
}

Available methods

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

Security

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

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of aws-sns with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
illuminate/notifications Version ^5.3|^5.4|^5.5|^5.6|^5.7|^5.8|^6.0
illuminate/support Version ^5.1|^5.2|^5.3|^5.4|^5.5|^5.6|^5.7|^5.8|^6.0
aws/aws-sdk-php-laravel Version ~3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package andreshg112/aws-sns contains the following files

Loading the files please wait ....