vform
Handle Laravel-Vue forms and validation with ease.
163,759
600
| Install | |
|---|---|
npm install vform |
|
| Latest Version: | 2.1.2 |
| Vue: | 1 · 2 · 3 |
| License: | MIT |
| Last Updated: | Jun 17, 2022 |
| Links: | GitHub · npm |
Maintainer: cretueusebiu
Handle Laravel-Vue forms and validation with ease
vform is a tiny library for Vue 2/3 to help with forms and validation when using Laravel as a back-end.
It provides a form instance to wrap your data in a convenient way and send it to your Laravel application via an HTTP request using axios.
Installation
npm install axios vform
Basic Usage
<template>
<form @submit.prevent="login" @keydown="form.onKeydown($event)">
<input v-model="form.username" type="text" name="username" placeholder="Username">
<div v-if="form.errors.has('username')" v-html="form.errors.get('username')" />
<input v-model="form.password" type="password" name="password" placeholder="Password">
<div v-if="form.errors.has('password')" v-html="form.errors.get('password')" />
<button type="submit" :disabled="form.busy">
Log In
</button>
</form>
</template>
<script>
import Form from 'vform'
export default {
data: () => ({
form: new Form({
username: '',
password: ''
})
}),
methods: {
async login () {
const response = await this.form.post('/api/login')
// ...
}
}
}
</script>
Laravel Controller:
<?php
class LoginController extends Controller
{
public function login(Request $request)
{
$this->validate($request, [
'username' => 'required',
'password' => 'required',
]);
// ...
}
}
Documentation
You'll find the documentation on vform.vercel.app.
Changelog
Please see CHANGELOG for more information what has changed recently.
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 2.1.2 | MIT | |
| 2.1.1 | MIT | |
| 2.1.0 | MIT | |
| 2.0.4 | MIT | |
| 2.0.3 | MIT | |
| 2.0.2 | MIT | |
| 2.0.1 | MIT | |
| 2.0.0 | MIT | |
| 1.0.1 | MIT | |
| 1.0.0 | MIT | |
| 0.8.2 | MIT | |
| 0.8.1 | MIT | |
| 0.8.0 | MIT | |
| 0.7.8 | MIT | |
| 0.7.7 | MIT | |
| 0.7.6 | MIT | |
| 0.7.5 | MIT | |
| 0.7.4 | MIT | |
| 0.7.3 | MIT | |
| 0.7.2 | MIT | |
| 0.7.1 | MIT | |
| 0.7.0 | MIT | |
| 0.6.0 | MIT | |
| 0.5.0 | MIT | |
| 0.4.5 | MIT | |
| 0.4.4 | MIT | |
| 0.4.3 | MIT | |
| 0.4.2 | MIT | |
| 0.4.1 | MIT | |
| 0.4.0 | MIT |
Showing the latest 30 of 50. See every release on npm