# vform

> Handle Laravel-Vue forms and validation with ease.

Latest version **2.1.2** (published 2021-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install vform
pnpm add vform
yarn add vform
bun add vform
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2021-10-28 |
| First published | 2016-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 45.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Cretu Eusebiu |
| Maintainers | cretueusebiu |
| Keywords | vue, form, laravel, validation |

## Links

- npm: https://www.npmjs.com/package/vform
- Repository: https://github.com/cretueusebiu/vform
- Homepage: https://github.com/cretueusebiu/vform#readme
- Issues: https://github.com/cretueusebiu/vform/issues
- npm.io page: https://npm.io/package/vform

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2021-10-28
- 2.1.1 — 2021-07-20
- 2.1.0 — 2021-06-14
- 2.0.4 — 2021-05-05
- 2.0.3 — 2021-04-29
- 2.0.2 — 2021-04-29
- 2.0.1 — 2021-04-29
- 2.0.0 — 2021-04-29
- 1.0.1 — 2019-06-01
- 1.0.0 — 2018-02-19
- 0.8.2 — 2018-01-31
- 0.8.1 — 2017-08-18
- 0.8.0 — 2017-08-15
- 0.7.8 — 2017-08-09
- 0.7.7 — 2017-08-04
- … 35 more at https://npm.io/package/vform/versions

## README

<p align="center">
  <img src="https://i.imgur.com/0IX1Otl.gif" width="700" alt="vform">
</p>

# Handle Laravel-Vue forms and validation with ease

<p>
  <a href="https://npmjs.com/package/vform"><img src="https://img.shields.io/npm/v/vform.svg?style=flat-square" alt="Latest Version on NPM"></a>
  <a href="https://github.com/cretueusebiu/vform/actions"><img src="https://github.com/cretueusebiu/vform/workflows/test/badge.svg" alt="Build Status"></a>
  <a href="https://npmjs.com/package/vform"><img src="https://img.shields.io/npm/dt/vform.svg?style=flat-square" alt="Total Downloads"></a>
</p>

`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

```bash
npm install axios vform
```

## Basic Usage

```html
<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
<?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](https://vform.vercel.app).

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

---
_Source: https://npm.io/package/vform · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
