Skip to content

Guide · Open source

How to use Livewire: setup, components and tips for Laravel

Updated · written with AI from the project's own documentation and checked against our catalogue data

Livewire is a full-stack framework for Laravel, the PHP web framework. It lets you build dynamic interface components while staying in PHP, instead of writing most of the front-end code by hand. This guide explains what you need before you start, where to find the official documentation, and how to set up a local copy of the project if you want to explore or contribute.

Livewirelivewire/livewire · ★ 23.6k · MIT

Quick start

  1. 1Check prerequisites. Make sure PHP, Composer, Node.js and Laravel are installed. Livewire is built for Laravel, so you need a Laravel project to use it.
  2. 2Read the official docs. Open livewire.laravel.com/docs for the guides on building components and features.
  3. 3Clone the repository. If you are contributing, run git clone git@github.com:livewire/livewire.git and then cd into the livewire folder.
  4. 4Run the setup script. Run composer setup to install PHP and JS dependencies and set up ChromeDriver for browser tests.
  5. 5Run the tests. Use composer test:unit for unit tests or composer test:browser for headless browser tests.
  6. 6Build assets after changes. After changing JavaScript, run npm run build to rebuild the assets.

What Livewire is and who it suits

Livewire is described in its README as a full-stack framework for Laravel that allows you to build dynamic UI components without leaving PHP. It is a good fit for PHP developers who already use Laravel and want interactive pages without a separate JavaScript frontend.

It is less suitable if you are not using Laravel, since the project is built specifically for it. It is also a poor match for projects that need a heavy client-side single-page app, because this approach keeps logic on the server.

  • Good fit: forms, dashboards and other dynamic UI inside Laravel apps
  • Good fit: teams that want interactive pages without a separate JavaScript frontend
  • Not a fit: projects not built on Laravel
  • Not a fit: heavy client-side single-page applications

What you need before you start

The source lists PHP, Composer, Node.js and Laravel as prerequisites. Composer manages the PHP dependencies, and Node.js is needed to build the JavaScript assets when you change them.

The README does not give specific version numbers for these tools, so check the official documentation for the versions it expects.

  • PHP
  • Composer
  • Node.js
  • Laravel

Read the official documentation

The README describes Livewire only briefly. The detailed guides, including how to create and use components, live on the official Livewire website at livewire.laravel.com/docs. Use that as your main reference for building features.

The README links to the documentation rather than repeating it, so the steps for building components in a Laravel app are not covered in the project's README itself.

Set up a local copy of the project

The README's local development steps are written for contributors who want to work on Livewire itself. Clone the repository, move into its folder, and run the setup script. According to the README, this installs PHP and JS dependencies and sets up ChromeDriver for browser tests.

Run the commands below from a terminal in the folder where you want the project to live.

git clone git@github.com:livewire/livewire.git && cd livewire composer setup

Run tests and build the JavaScript assets

The README lists several test commands. Unit tests run with one command, browser tests run headless, and a headed option opens Chrome so you can watch the tests. You can also target a specific test by passing a filter.

After you change JavaScript, the README says to build the assets with npm.

  • Unit tests: composer test:unit
  • Browser tests (headless): composer test:browser
  • Browser tests (opens Chrome): composer test:browser:headed
  • A specific test: composer test:browser -- --filter="SupportCSP"
composer test:unit composer test:browser composer test:browser:headed composer test:browser -- --filter="SupportCSP" npm run build

Contribute and check the licence

To contribute, read the contribution guide at .github/CONTRIBUTING.md in the repository. Security issues should be reported through the project's security policy rather than a public issue.

Livewire is open-source software licensed under the MIT license, as stated in the LICENSE.md file.

What people use it for

  • Building interactive forms inside a Laravel app without writing a separate JavaScript frontend
  • Creating dashboards and other dynamic UI that updates while keeping logic in PHP
  • Contributing fixes to Livewire by running its unit and browser test suites

Frequently asked questions

Is Livewire free to use?

Yes. Livewire is open-source software licensed under the MIT license, as stated in the project's LICENSE.md file. Check the license file for the full terms.

What do I need to install Livewire?

The source lists PHP, Composer, Node.js and Laravel as prerequisites. Livewire is built specifically for Laravel, so it needs a Laravel project. The README does not give version numbers, so check the official docs for those.

Does Livewire work without Laravel?

No. The project is built specifically for Laravel, so it is not intended for use outside that framework.

Do I need to write JavaScript to use Livewire?

Livewire is designed to let you build dynamic UI components while staying in PHP, rather than writing most of the front-end code by hand. The README says it keeps logic on the server. You only need npm when you change the JavaScript assets.

What is the difference between Livewire and Inertia.js?

Both are commonly compared in the Laravel world. The source does not describe Inertia.js, so this guide cannot make a detailed comparison. Livewire keeps logic on the server, which suits interactive pages without a separate JavaScript frontend.

What is the official documentation for Livewire?

The official documentation is on the Livewire website at livewire.laravel.com/docs. The README links to it for detailed guides.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Livewire suits PHP developers who already use Laravel and want interactive forms, dashboards and dynamic UI without a separate JavaScript frontend. It is a poor choice if you do not use Laravel or need a heavy client-side single-page app. The README is brief, so rely on the official documentation for how to build with it.

Install options & downloads