Download the PHP package aridez/simple-mail-builder without Composer

On this page you can find all versions of the php package aridez/simple-mail-builder. 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 simple-mail-builder

Simple Mail Builder

A tool to easily create emails in Laravel using a fluent interface.

Table of Contents

Installation

You can install the package via composer:

If you want to customize the mail views, you can publish them running:

Usage

Basic Usage

To start using the package, you need to create an instance of MailMessageBuilder or just use the Mailbuilder facade. Here's a basic example of how to use the package within a Laravel notification:

This code will create an email that looks like this:

preview

Quick reference

The MailMessageBuilder class provides several methods to add components and pass data to your views:

Method Description
brand(string $image_url) Insert a brand image component.
title(string $title) Insert a title component.
text(string $text) Insert a plain text component.
button(string $button_text, string $button_url) Insert a clickable button component.
link(string $link_text, string $link_url) Insert a clickable link component.
italic(string $text) Insert a grey italic text component.
space(int $height) Insert vertical space component.
theme(string $theme) Change the theme of the email view.
component(string $name, array $props = []) Insert an arbitrary component with props.
include(array $data) Append an array of top-level data.

Creating new components

You can customize your views by creating or modifying the default theme of this package. First, publish the views as seen in the installation section. This makes them available under the folder resources\views\vendow\mailbuilder\components\themes\default.

In order to create a component, just create a new blade file under that directory. You can take another of the default theme components as an example. Let's create a small text component called small-text.blade.php:

Now, we will be able to use this component by calling the function component. The first parameter is a string that must be the name of the view (in this case small-text) and the second is a key => value array where the keys must be the same as the props defined in our component:

Creating a new theme

To create a new whole custom theme, just create a new folder under resources\views\vendor\mailbuilder\components\themes with the name of the theme you want to use and modify there the files accordingly:

resources/views/vendor/mailbuilder/components/themes

├── default
│ ├── brand.md
│ ├── title.md
│ ├── text.md
│ ├── button.md
│ ├── link.md
│ ├── italic.md
│ └── space.md

├── blue
│ ├── brand.md
│ ├── title.md
│ ├── text.md
│ ├── button.md
│ ├── link.md
│ ├── italic.md
│ └── space.md

Whenever you create a new theme, it is important to use the index.blade.php as an entry point and also include the following lines where you will want to insert the parametrized components:

These lines are in charge of calling, rendering and passing any props to the corresponding view. You can take a look at the index.blade.php file as an example.

Finally, to use a different theme you can call the theme function passing the name of the theme as a parameter:

Passing additional data

Sometimes, you will also want to pass additional data accessible from your index.blade.php component, for example for headers or footers. For those cases you can use the include function and pass a key => value array that will get passed normally to your view. For example, if we want to access a $footer variable from our index component we can do:

📝 Note: Make sure to avoid using the components key since it is reserved to render the array of components

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Make your changes.
  4. Commit your changes (git commit -am 'Add new feature').
  5. Push to the branch (git push origin feature/your-feature).
  6. Create a new Pull Request.

To prepare the development environment, you need to add it to your Laravel application. Developing locally, you can create a local repository. In your Laravel project's composer.json, add the local repository path:

Then you can require the package normally:

Other


All versions of simple-mail-builder with dependencies

PHP Build Version
Package Version
No informations.
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 aridez/simple-mail-builder contains the following files

Loading the files please wait ....