PHPackages                             otrigg/form-mailer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. otrigg/form-mailer

ActiveLibrary[API Development](/categories/api)

otrigg/form-mailer
==================

A simple Laravel-based api service for handling forms from static web sites.

12PHP

Since Aug 25Pushed 6y ago1 watchersCompare

[ Source](https://github.com/otrigg/form-mailer)[ Packagist](https://packagist.org/packages/otrigg/form-mailer)[ RSS](/packages/otrigg-form-mailer/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Simple Laravel Contact Form Mailer API
======================================

[](#simple-laravel-contact-form-mailer-api)

A simple Laravel-based api service for handling contacts forms. Can handle forms on static web sites, too.

Introduction
------------

[](#introduction)

When deploying a web site, you often need to put a contact form somewhere. If you have a static website, there are only a few solutions to handle forms: implementing some sort of server-side logic and or paying for an external service.

If you have a Laravel based server somewhere, you can rely on this simple API for handling contact forms on multiple websites.

This package creates on your Laravel app an easy entry point:

```
https://yourapp.dev/api/send

```

where to post all your contact forms. The api will handle the post requests and mail them to selected addresses.

Features
--------

[](#features)

- Server-side validation
- Google reCAPTCHA

Package dependencies
--------------------

[](#package-dependencies)

- [No CAPTCHA reCAPTCHA](https://github.com/anhskohbo/no-captcha)

Getting Started
---------------

[](#getting-started)

### Prerequisites

[](#prerequisites)

- PHP ^7.1.3
- Laravel ^5.5

### Installing

[](#installing)

Open a console window in the root of your Laravel app and install the package using composer:

```
composer require otrigg/form-mailer

```

And after that:

```
composer install

```

If you can't take advantage of Laravel's *auto discovery* feature, append

```
Otrigg\Formmailer\Providers\FormmailerServiceProvider::class,
```

at the end of the provider array located into `config/app.php`

Then, publish the configuration file into Laravel's `/config` folder:

```
php artisan vendor:publish

```

Configuration
-------------

[](#configuration)

### Add key to `.env` file

[](#add-key-to-env-file)

First of all, append to your app's `.env` file:

```
OTRIGG_FORMMAILER_MODE=strict

```

if you want to authorize only a certain list of websites where the form is hosted, otherwise leave the key empty:

```
OTRIGG_FORMMAILER_MODE=

```

### Customize `config/formmailer.php`

[](#customize-configformmailerphp)

Then, edit the published `config/formmailer.php` to customize the API.

### Application ID

[](#application-id)

Insert a list of authorized app IDs that can use the API.
Use random generated alphanumeric strings such as:

```
    'app_id' => [
        'th151sAr4nd0m5tr1ng',
    ],
```

### Edit referrals

[](#edit-referrals)

Insert a list of complete web addresses where the form is hosted:

```
    'referrals' => [
        'http://mywebsite.com/myform.html',
    ],
```

don't forget to add a slash at the end of nice URLs if your server uses it, i.e.:

```
    'referrals' => [
        'http://mywebsite.com/contacts/',
    ],
```

### Add recipients

[](#add-recipients)

Add a list of email addresses where the forms will be sent:

```
    'recipients' => [
        'admin@example.com',
        'info@commercial.com',
        ...
    ],
```

### Define validation rules

[](#define-validation-rules)

Customize the rules according to your form fields. Write rules compatible with [Laravel's built-in validator:](https://laravel.com/docs/5.8/validation)

```
    'rules' => [
        'name' => 'required|max:255',
        'email' => 'required|email|max:255',
        'message' => 'required|max:1024',
        'sender' => 'required|email|max:255',
        'g-recaptcha-response' => 'required|captcha',
    ],
```

`sender` refers to the email address that will fill the `From:` field. It is **required** by default.

**Warning**: Google reCAPTCHA is set as **required** by default.

If you want to use Google reCAPTCHA don't forget to [generate Google reCAPTCHA public and private keys](https://www.google.com/recaptcha/admin) and add them to the `.env` file of your Laravel app:

```
NOCAPTCHA_SITEKEY=google_recaptcha_public_key
NOCAPTCHA_SECRET=google_recaptcha_secret_key

```

Author
------

[](#author)

- [**Enea Barbetta**](https://github.com/otrigg)

See also the list of [contributors](https://github.com/otrigg/form-mailer/graphs/contributors) who participated in this project.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18140685?v=4)[Enea Barbetta](/maintainers/otrigg)[@otrigg](https://github.com/otrigg)

---

Top Contributors

[![otrigg](https://avatars.githubusercontent.com/u/18140685?v=4)](https://github.com/otrigg "otrigg (8 commits)")

### Embed Badge

![Health badge](/badges/otrigg-form-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/otrigg-form-mailer/health.svg)](https://phpackages.com/packages/otrigg-form-mailer)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
