8000 GitHub - tomirons/tuxedo at 1.0.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tomirons/tuxedo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tuxedo

Version License Total Downloads

Tuxedo is an easy way to send transactional emails with Laravel's Mail classes, with the templates already done for you.

Contents

Installation

  1. Run the following command:
$ composer require tomirons/tuxedo
  1. Open your config/app.php and add the following class to your providers array:
TomIrons\Tuxedo\TuxedoServiceProvider::class
  1. (Optional) If you would like to edit the templates, run the following command to publish them
php artisan vendor:publish --provider=TomIrons\Tuxedo\TuxedoServiceProvider

Classes

There are currently 3 different types of classes you can extend. ActionMailable, AlertMailable, and InvoiceMailable, and each have their own special properties and methods.

General Methods

  • gretting($gretting) - Sets the greeting for the message.
  • line($line) - Add a line of text to the message.

ActionMailable

Methods

  • header($header) - Sets th 8000 e header text for the message, it'll only be displayed if it's set.
  • level($level) - Sets the level type of the button. Available options are success and error.
  • action($text, $url) - Sets the button text and url.
  • success() - Sets the level type to success.
  • error() - Sets the level type to error.

Example

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use TomIrons\Tuxedo\Mailables\ActionMailable;

class TuxedoTestMail extends ActionMailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Build the message.
     *
     */
    public function build()
    {
        return $this->header('Some Random Header')
                    ->level('success')
                    ->line('Some line of text to tell you what exactly is going on.')
                    ->action('Click Me', url('/'))
                    ->line('Some other information to be displayed after the button.');
    }
}

AlertMailable

Methods

  • type($type) - Sets the type of alert, options are success, warning, and error.
  • message($message) - Sets the message to display in the alert.

Example

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use TomIrons\Tuxedo\Mailables\AlertMailable;

class TuxedoTestMail extends AlertMailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Build the message.
     *
     */
    public function build()
    {
        return $this->type('success')
                    ->message('A message that goes inside the alert.')
                    ->line('Some line of text to tell you what exactly is going on.');
    }
}

InvoiceMailable

Methods

  • information($name, $number, $date) - Sets the information that gets displayed at the top invoice.
  • item($name, $price) - Add an item to the invoice

Example

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use TomIrons\Tuxedo\Mailables\InvoiceMailable;

class TuxedoTestMail extends InvoiceMailable 
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Build the message.
     *
     */
    public function build()
    {
        return $this->information('John Doe', '123456', date('F jS, Y'))
                    ->item('Example Product', '123.99')
                    ->item('Another Example Product', '321.99');
    }
}

License

Tuxedo is open-sourced software licensed under the MIT license

About

Simple transactional email classes/templates for Laravel 5 mailables

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  
0