Download the PHP package yhw/laravel-email-database-log without Composer

On this page you can find all versions of the php package yhw/laravel-email-database-log. 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 laravel-email-database-log

Laravel Email Database Log

A simple database logger for all outgoing emails sent by Laravel website. Forked from ShvetsGroup\LaravelEmailDatabaseLog.

For Laravel 5.8 - use 2.* versions

For Laravel 6 - use 3.* versions

For Laravel 7 - use 4.* versions

For Laravel 8 - use 5.* versions

Version 5.1 is using Filesystems which is a breaking change from 5.3. See below for upgrade information.

Custom Templates

To make the email log integrate better with your laravel theme, set the path to your blade files, using the EMAIL_LOG_CUSTOM_TEMPLATE option, in your .env file.

The blade files I use are in the custom_templates folder.

In my project they are in resources\views\admin\templates\email_logger\

and my .env file has the lines:

Installation

Step 1: Composer

Laravel Email Database Log can be installed via composer by running this line in terminal:

Step 2: Configuration

You can skip this step if your version of Laravel is 5.5 or above. Otherwise, you have to add the following to your config/app.php in the providers array:

Step 3: Migration

Now, run this in terminal:

Step 4: Config

To publish config file run this in terminal:

Config contains following parameters:

Usage

After installation, any email sent by your website will be logged to email_log table in the site's database.

Any attachments will be saved in storage/email_log_attachments disk. The email_log_attachments can be changed by publishing the config file and changing the 'folder' value.

You also need to add the following disk in the config/filesystems.php file:

If you want to process the logged email or save/format some additional data on your system you can hook up to the Yhw\LaravelEmailDatabaseLog\LaravelEvents\EmailLogged event via a Laravel listener:

https://laravel.com/docs/5.5/events#defining-listeners

Don't forget to register the event:

https://laravel.com/docs/5.5/events#registering-events-and-listeners

If you're using Laravel >=5.8.9 you can use Event Discovery instead:

https://laravel.com/docs/5.8/events#registering-events-and-listeners

If using queues on your server you will need to restart the worker for the library to work:

You can review sent emails using the following URI /email-log.

You can prefix this URI by adding something like EMAIL_LOG_ROUTES_PREFIX=prefix/ to your .env file.

You can protect this URI using middleware by adding something like EMAIL_LOG_ACCESS_MIDDLEWARE=auth,landlord to your .env file.

MailGun webhooks

You can use Mailgun webhooks to log webhook events. In your MailGun Webhooks section add:

for all of the events. If you used a prefix in the config file then this should be reflected in the url:

Upgrade from 5.2.2 to 5.3.0 - API ENDPOINTS AVAILABLE, BREAKING CHANGE

API ENDPOINTS AVAILABLE:

New routes with JSON responses:

BREAKING CHANGE:

The logic for presentation of attachments (on single email view: show.blade.php) has been moved to backend. If you are not using the default show.blade.php and are displaying list of attachments you should reflect these changes in your code. Namely, you no need to check if the file exists or add the attachment to the route to access it. Instead the returned data will be array with of following formats (depending if file can be found on disk or not):

Note following: /api part will be dropped in html response, email-id is the id of the email, attachment-key is the order of attachment starting at 0.

Upgrade from 5.1.0 to 5.2.0 - BREAKING CHANGE

Add the following parameters to the end of the config/email_log.php array:

Upgrade from 5.0.3 to 5.1.0 - BREAKING CHANGE

IMPORTANT - please upgrade to 5.2.1 right away as there are some fixes for the 5.1.0 upgrade. I was hastly and missed some issues which are corrected in 5.2.1.

As email log attachments might quickly grow to large size you'd want to use some external storage to save them. To enable this we need to utilize the Laravel's Filesystem. Follow the guide below if you were using the 5.0.3 and wish to upgrade to 5.1.0.

Change a line in config/email_log.php file from:

to

In config/filesystems.php add

the 'root' must point to the folder where you were previously saving the attachements.

You will also need to drop the current prefix from the email_log.attachments column (default was email_log_attachments). For example email_log_attachments/12345678910/my_file.jpg should be renamed to 12345678910/my_file.jpg.

You can run following code using php artisan tinker to fix these issues. Depending on the amount of data, it could take some time to finish:


All versions of laravel-email-database-log with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^8.0|^9.0|^10.0
illuminate/database Version ^8.0|^9.0|^10.0
illuminate/mail Version ^8.0|^9.0|^10.0
illuminate/queue Version ^8.0|^9.0|^10.0
doctrine/dbal Version *
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 yhw/laravel-email-database-log contains the following files

Loading the files please wait ....