Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Browse all series

Learn Laravel and Vite

Laravel provides seamless integration with Vite, a next generation front-end bundler that is lightning fast. In this miniseries, join me as I outline Laravel's Vite integration in a way that's easy to understand. You'll be bundling your client-side assets in no time!

Progress

Series Info

Episodes
8
Run Time
57m
Difficulty
Intermediate
Last Updated
May 22, 2024
Version
Latest

Series Episodes

  1. Laravel's Vite Integration (8)
    1. Getting Started with Vite

      Vite is included with every Laravel project. So, let's create a project and look at how to set up Vite.
    2. Processing Static Assets

      If it's a client-side asset, Vite can process it. In this episode, you'll learn how to configure Vite to process static assets and use Laravel's Vite::asset() method to generate URLs for them.
    3. Using Aliases

      Aliases allow you to simplify the paths to your modules or assets. Instead of writing out the full path every time you import a module or asset, you can use a shorter, more intuitive alias. Let's look at how to create them.
    4. Installing Vue and Using Environment Variables

      Chances are good that you will use a framework like Vue. In this episode, we'll install and configure Vue for our project. You'll also learn how to create and use environment variables with Vite.
    5. Installing React

      Vue isn't your cup o' tea? Then let's look at how to install and configure React in a project. But seriously, use a preset.
    6. Applying Attributes to Elements

      Laravel and Vite generate the <script> and tags that it needs to resolve our assets, but what if you need to apply attribues to those tags? You can! I'll show you how to use the Vite facade to do so.
    7. Testing with Vite

      Laravel's integration with Vite requires that your tests be able to resolve assets. I'll show you three ways you can handle Vite-processed assets for your tests.
    8. Customizing Laravel's Vite Plugin

      Out of the box, Laravel's Vite plugin uses settings that are just fine for most applications, but you may want to change Vite's behavior for some applications. I'll show you how you can do that.

Continue Learning