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: 7 months ago
JSON representation
Simple contact form created with Livewire
- Host: GitHub
- URL: https://github.com/vojislavd/livewire-contact-form
- Owner: VojislavD
- License: mit
- Created: 2021-11-11T13:23:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-27T12:16:21.000Z (over 4 years ago)
- Last Synced: 2024-04-25T00:35:02.790Z (about 2 years ago)
- Topics: livewire, livewire-components
- Language: PHP
- Homepage:
- Size: 136 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
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.
```
CONTACT_FORM_MAIL_TO=test@example.com
```
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.