npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-laravel-error-validator

v2.0.0

Published

A Vue.JS plugin that adds a global function which can be used to fill and display errors from a laravel error response

Downloads

52

Readme

Vue Laravel Errors

This package allows to display errors from Laravel for Vue 3.

Installation

You can install the package via npm:

npm install --save vue-laravel-error-validator

Setup

import { createApp } from 'vue'
import LaravelErrorValidator from "vue-laravel-error-validator";
import App from './App.vue'

const app = createApp(App)
app.use(LaravelErrorValidator)
app.mount('#app')

Usage

Options API (Vue 3)

Once the plugin is registered, you can access the error handler using $errors:

<template>
  <div>
    <input type="text" v-model="form.name">
    <p class="error" v-if="$errors.has('name')">{{ $errors.first('name') }}</p>
    
    <!-- Or use the included error component -->
    <error field="name" />
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        name: ''
      }
    }
  },
  methods: {
    submitForm() {
      axios.post('/api/endpoint', this.form)
        .catch(error => {
          // Validation errors are automatically captured by the axios interceptor
          // if the status code is 422
        });
    }
  }
}
</script>

Composition API

You can also use the provided useErrors composable:

<template>
  <div>
    <input type="text" v-model="form.name">
    <p class="error" v-if="errors.has('name')">{{ errors.first('name') }}</p>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { useErrors } from 'vue-laravel-error-validator';

const errors = useErrors();
const form = ref({ name: '' });

function submitForm() {
  axios.post('/api/endpoint', form.value);
}
</script>

Available Methods

  • has(field): Check if a field has any errors
  • first(field): Get the first error message for a field
  • get(field): Get all error messages for a field
  • all(): Get all error messages
  • any(): Check if there are any errors
  • record(errors): Set the error object
  • clear(field): Clear a specific field's errors (or all if no field is specified)
  • flush(): Clear all errors
  • onKeydown(event): Clear errors on keydown event

Automatic Error Handling

The plugin automatically intercepts 422 responses from Laravel backend and captures validation errors if Axios is available globally.