Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vojislavd/livewire-contact-form

Simple contact form created with Livewire
https://github.com/vojislavd/livewire-contact-form

livewire livewire-components

Last synced: about 2 months ago
JSON representation

Simple contact form created with Livewire

Awesome Lists containing this project

README

        

# Simple contact form created with Livewire

---
This Laravel package add simple Livewire component for contact form, without any styling.

---
Once package is installed, include Livewire component on page where you want to have contact form, with one of Livewire's method for rendering component.

`@livewire('livewireContactForm:contact-form')`

or

``

## Installation

You can install the package via composer:

```bash
composer require vojislavd/livewire-contact-form
```

After that run install command:
```bash
php artisan livewirecontactform:install
```
#### NOTE
Make sure to include Livewire scripts on every page you plan to use this component.

Add `@livewireStyles` inside `` tag of your HTML page and add `@livewireScripts` right before closing `` tag.

For example:
```html



Laravel
@livewireStyles

@livewireScripts

```

Optionally, you can publish:

Config file again:
```bash
php artisan vendor:publish --provider="VojislavD\LivewireContactForm\LivewireContactFormServiceProvider" --tag="config"
```

Views:
```bash
php artisan vendor:publish --provider="VojislavD\LivewireContactForm\LivewireContactFormServiceProvider" --tag="views"
```

Livewire component:
```bash
php artisan vendor:publish --provider="VojislavD\LivewireContactForm\LivewireContactFormServiceProvider" --tag="livewire-component"
```

Mail:
```bash
php artisan vendor:publish --provider="VojislavD\LivewireContactForm\LivewireContactFormServiceProvider" --tag="mail"
```

This is the contents of the published config file:

```php
return [
'mail' => [
'to' => env('CONTACT_FORM_MAIL_TO', null)
]
];
```

## Usage
In .env file define email address where messages from contact form will be sent.

```
[email protected]
```

Include component to your HTML page
```html
@livewire('livewireContactForm:contact-form')
```

To style contact form or email, publish view assets.

Edit Contact Form: `resrouces/views/vendor/livewireContactForm/livewire/contact-form.blade.php`

Edit Mail: `resrouces/views/vendor/livewireContactForm/mail/contact-form-mail.blade.php`

## Testing
Run the tests with:

```bash
composer test
```

## Credits

- [Vojislav Dragicevic](https://vojislavd.com/)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.