dainsys / mailing
Mailing and recipients management package for Dainsys. This package allows you to Associate recipients to your mailable files.
Installs: 33
Dependents: 2
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Language:SCSS
Requires
- illuminate/support: ^8.0|9.0
- laravel/ui: ^3.0|4.0
- livewire/livewire: ^2.10
- php-flasher/flasher-laravel: ^1.7
- rappasoft/laravel-livewire-tables: ^2.8
Requires (Dev)
- nunomaduro/collision: v5.x-dev
- orchestra/testbench: 6.x-dev
- phpunit/php-code-coverage: 9.2.x-dev
README
A full stack package to add mailing functionality to Laravel applications. This package allows you to associate recipients (contacts) to your mailable files.
Installation
- Require using composer:
composer require dainsys/mailing
. - You can install all package assets by running
php artisan mailing:install
command.- Another option is installing each asset individually:
- Publish the assets:
@php artisan vendor:publish --force --tag=mailing:assets
.- optionally, you add the following line to your
composer
file, under thescripts
andpost-update-cmd
key, to publish the assets every time you update your composer dependencies:@php artisan vendor:publish --tag=mailing:assets --force --ansi
.
- optionally, you add the following line to your
- Publish the assets:
- If you may want to customize the migrations before next step, first publish them:
@php artisan vendor:publish --force --tag=mailing:migrations
. - Run the migrations:
php artisan migrate
.
- Another option is installing each asset individually:
- Only super admin users are allowed to interact with the app. You can register them using any of the following options:
- Using the register method of your
AuthServiceProvider
:\Dainsys\Mailing\Mailing::registerSuperUsers(["super@user1.com", "super@user2.com"]);
. - In your
.env
file,MAILING_SUPER_USERS='super@user1.com,super@user2.com'
- Using the register method of your
Configure your application
- Visit package main route:
/dainsys/mailing/about
. - Optionally, you may want to publish and tweek the config file:
@php artisan vendor:publish --force --tag=mailing:config
. - This package has its own views, designed with livewire and AdminLte. However, if you may want to change them then you can publish them with
@php artisan vendor:publish --force --tag=mailing:views
. - Package views extend it's own layout app. However, you can change this by adding the key
MAILING_LAYOUT_VIEW
to your.env
file. Or, change it directly in themailing
config file, under thelayout
key.
Usage
- The package is configured to auto discover your mailables within then
app\Mail
directory. However, if your mailables reside outside this folder or if you want to register another directory, add the line\Dainsys\Mailing\Mailing::bind(app_path('Mail'));
to yourAppServiceProvider
. The package will try to load all your mailables for all directories added. - Visit route
/mailing/admin/recipients
to manage your recipients contacts. - Visit route
/mailing/admin/mailables
to manage your mailables and assign them to the recipients. - In your mailables, you can access the array of recipients associated to that class with the code snippet
\Dainsys\Mailing\Mailing::recipients($this);
. For example,->to(\Dainsys\Mailing\Mailing::recipients($this))