User interface demo's

Out of the box the routes are NOT protected. Please add proper authorization when using this in public accessible environments.

To quickly provide an email viewer, this package provides two simple UI's:

  • Blade

  • Vue.js

Both examples use Tailwind css for the minimal styling of the user interfaces. You can use these examples as a starting point to wire the functionalitity of this package in your own application. Bot examples use CDN's for its assets, so for a production setup, you might want to use proper assets building.

Blade

The Blade UI example is powered by the BladeEmailController endpoints and can be accessed by:

~/emails

<?php

namespace Axyr\EmailViewer\Http\Controllers;

use Axyr\EmailViewer\Facades\Emails;
use Illuminate\Http\RedirectResponse;
use Illuminate\View\View;
use Symfony\Component\HttpFoundation\Response;

class BladeEmailController
{
    public function index(): View
    {
        $emails = Emails::server()->paginate();

        return view('email-viewer::index', compact('emails'));
    }

    public function show(string|int $id): View
    {
        $emails = Emails::paginate();
        $email = Emails::server()->find($id);

        abort_if(! $email, Response::HTTP_NOT_FOUND);

        return view('email-viewer::show', compact('emails', 'email'));
    }

    public function destroy(string|int $id): RedirectResponse
    {
        Emails::delete($id);

        $routeNamespace = config('emailviewer.route-prefix');

        return redirect(route($routeNamespace . '.index'));
    }
}

Vue.js

A simple Vue.js example is included to provide a simple starter setup for SPA based applications. The idea of this example is to provide helper methods to display the html and raw versions of the email in a javascript UI. In a real wordt scenario your probabaly want to organize this into separate Single File Components.

This example is powered by the JsonEmailController:

Last updated