Download the PHP package lm-commons/lmc-mail without Composer

On this page you can find all versions of the php package lm-commons/lmc-mail. 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 lmc-mail

Continuous Integration Latest Stable Version Total Downloads License PHP Version Require

LmcMail

An email service module that provides the ability to use the View renderer of a Laminas MVC application and the installed View Helper plugins to render HTML emails.

Requirements

Installation

Install the module:

`

Composer will inject the module into the modules configuration, or you can add it manually to the modules.config.php or application.config.php.

Customize the module by copying and renaming the sample configuration file lm-commons/lmc-mail/config/lmcmail.local.php.dist to the application's config/autoload.

Configuration

LmcMail supports with the Laminas SMTP Mail Transport or the Laminas File Mail Transport and this is configured by the transport config key in the lmcmail.local.php file:

`` In a development environment, it is typical to use a File Mail Transport. In a production environment, an SMTP Mail Transport will more likely be used.

The 'transport' configuration must comply with the Laminas\Mail\Transport\Factory\Factory::create method.

The 'from' configuration defines a default from address. The from address can also be specified at message creation.

Usage

The Mail service can be retrieved from the service manager:

``

Basic example to send an HTML email:

``

The 'mail/html' template must exist in the application's view template map. The HTML mail renderer will use a layout template aliased as 'mail/layout' in the view template map. This is defined in the module.config.php file.

Available methods

createHtmlMessage

` If$nameorModel` is a string, it must correspond to the view template to use.

createTextMessage

` If$nameorModel` is a string, it must correspond to the view template to use.

send

` where$messagecan be any object of type\Laminas\Mail\Message` not necessarily one created by the above methods.

Advanced Customizations

LmcMail can be customized to the applications needs.

Using view templates

LmcMail uses nested view models to render the body of HTML messages.

In a similar fashion to the view model structure of the Laminas MVC Skeleton, the body is rendered using a layout view model to which the view model parameter ($nameOrModel) to the createHtmlMessage method is added a child. The rendered output of the $nameOrModel view model is captured in the variable message which is passed to the layout view model.

A default template mail/layout is supplied is view/layout/layout.phtml. This template can be the starting point for your own layout template. The layout template can be set using the setLayoutTemplate() method. Alternatively, the mail/layout entry in the View Manager template map can be overridden to point to your template. Another alternative is to use a factory delegator to the MessageServiceFactory::class to set the layout template after the Message Service is created.

View Helpers can be used when rendering view models. A common use case is to use $this->url() to render a link to your application.

Use alternate View Resolved and View Helper Manager

LmcMail uses Service Manager aliases to get the View Resolver and View Helper Manager which resolves to the Laminas MVC resolver and manager. This allows to use any view template and helpers already defined in the application.

`` If you want to use a different resolver and view helper manager, then update the aliases to point to your classes:

``

If you want to use your own renderer, then you can override the Service Manager factory: ``

Event Listening

MessageService::send() triggers two events:

The listener to these events will receive an event of classMessageEvent that extends the Event class with:

The MessageService::send() method, after triggering the MessageEvent::SEND event, will retrieve the message from the event and pass it to the transport service. This allows for the listener to modify the message if needed.

A typical use case for listening to the send events would be to log that a message was sent.


All versions of lmc-mail with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laminas/laminas-servicemanager Version ^3.0
laminas/laminas-modulemanager Version ^2.1
laminas/laminas-mail Version ^2.1
laminas/laminas-view Version ^2.1
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 lm-commons/lmc-mail contains the following files

Loading the files please wait ....