mzur / kirby-uniform
A versatile Kirby plugin to handle web form actions.
Fund package maintenance!
mzur
www.paypal.me/drmzur
Installs: 45 912
Dependents: 10
Suggesters: 1
Security: 0
Stars: 253
Watchers: 13
Forks: 40
Open Issues: 6
Type:kirby-plugin
Requires
- getkirby/composer-installer: ^1.2
- mzur/kirby-form: ^3.0
Requires (Dev)
- getkirby/cms: ^3.5 || ^4.0
- phpunit/phpunit: ^9.0
- dev-master
- v5.6.1
- v5.6.0
- v5.5.2
- v5.5.1
- v5.5.0
- v5.5.0-beta
- v5.4.2
- v5.4.1
- v5.4.0
- v5.3.2
- v5.3.1
- v5.3.0
- v5.3.0-beta3
- v5.3.0-beta2
- v5.3.0-beta
- v5.2.0
- v5.2.0-beta
- v5.1.0
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.3.3
- v4.3.2
- v4.3.1
- v4.3.0
- v4.2.3
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.0
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v4.0.0-beta2
- v4.0.0-beta
- v3.5.0
- v3.4.0
- v3.3.1
- v3.3.0
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.1
- v3.0.0
- 3.0.0-beta
- dev-kirby-plugin
- dev-kirby-2
This package is auto-updated.
Last update: 2024-12-07 12:09:50 UTC
README
A versatile Kirby plugin to handle web form actions.
This is Uniform for Kirby >=3. You can find Uniform for Kirby 2 in the kirby-2 branch.
Builtin actions:
- Email: Send the form data by email.
- EmailSelect: Choose from multiple recipients to send the form data by email.
- Log: Log the form data to a file.
- Login: Log in to the Kirby frontend.
- SessionStore: Store the form in the user's session.
- Upload: Handle file uploads.
- Webhook: Send the form data as an HTTP request to a webhook.
Quick example
Controller:
<?php use Uniform\Form; return function ($kirby) { $form = new Form([ 'email' => [ 'rules' => ['required', 'email'], 'message' => 'Email is required', ], 'message' => [], ]); if ($kirby->request()->is('POST')) { $form->emailAction([ 'to' => 'me@example.com', 'from' => 'info@example.com', ])->done(); } return compact('form'); };
Template:
<form action="<?php echo $page->url() ?>" method="POST"> <input name="email" type="email" value="<?php echo $form->old('email'); ?>"> <textarea name="message"><?php echo $form->old('message'); ?></textarea> <?php echo csrf_field(); ?> <?php echo honeypot_field(); ?> <input type="submit" value="Submit"> </form> <?php if ($form->success()): ?> Success! <?php else: ?> <?php snippet('uniform/errors', ['form' => $form]); ?> <?php endif; ?>
Installation
Install Uniform via Composer: composer require mzur/kirby-uniform
Or download the repository and extract it to site/plugins/uniform
.
Setup
Add this to your CSS:
.uniform__potty { position: absolute; left: -9999px; }
Note: Disable the Kirby cache for pages where you use Uniform to make sure the form is generated dynamically.
Documentation
For the full documentation head over to Read the Docs.
Questions
See the answers in the docs, post an issue if you think it is a bug or create a topic in the forum if you need help.
Contributing
Contributions are always welcome!
Donations
Since some people insist on sending me money for this (free) plugin you can do this here.