PHPackages                             wewowweb/laravel-svelte-preset - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wewowweb/laravel-svelte-preset

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wewowweb/laravel-svelte-preset
==============================

Svelte frontend preset for Laravel.

v0.2.1(3y ago)747.2k4[1 PRs](https://github.com/wewowweb/laravel-svelte-preset/pulls)MITPHPPHP ^7.2|^8.0CI failing

Since May 21Pushed 3y ago13 watchersCompare

[ Source](https://github.com/wewowweb/laravel-svelte-preset)[ Packagist](https://packagist.org/packages/wewowweb/laravel-svelte-preset)[ Docs](https://github.com/wewowweb/laravel-svelte-preset)[ RSS](/packages/wewowweb-laravel-svelte-preset/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (4)Versions (12)Used By (0)

Laravel Svelte Preset
=====================

[](#laravel-svelte-preset)

A Laravel frontend preset for initial Svelte scaffolding.

Why?
----

[](#why)

Svelte is an interesting new approach in the JavaScript space, created by [@Rich\_Harris](https://twitter.com/Rich_Harris). While traditional frontend frameworks do the bulk of their work in the browser, Svelte does this in compilation step. They provide a fluid syntax for writing expressive code, but compile it down to small, framework-less vanilla JavaScript.

If you don't know what Svelte is, we highly recommend starting with Rich Harris' talk [Rethinking Reactivity](https://youtu.be/AdNJ3fydeao) from YGLF Code Camp 2019, his [introductory blog post](https://svelte.dev/blog/svelte-3-rethinking-reactivity) or - if you're more of a hands-on type - Svelte's [interactive tutorial](https://svelte.dev/tutorial/).

*This package is still in active development, so you might want to [watch](https://github.com/wewowweb/laravel-svelte-preset/subscription) the repository to be notified of future changes.*

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require wewowweb/laravel-svelte-preset
```

After that, run the following command, which will provide you with the initial scaffolding of the project:

```
php artisan ui svelte
```

To install the JavaScript dependencies, run:

```
npm install && npm run dev
```

The package will provide you with the initial set of files:

- `/js/app.js`
- `/js/components/App.svelte`
- `webpack.mix.js`

needed to start developing with Laravel &amp; Svelte.

### Usage

[](#usage)

```
>

    ...

```

### Registering Custom Svelte Components

[](#registering-custom-svelte-components)

If you wish to use custom components, note you cannot use regular svelte components. Doing so will result in an invalid constructor error for the svelte component.

Please follow these general conventions when creating your custom components:

- Component name must be two or more words joined by the '-' character e.g. 'my-test-component'.
- Components can be accessed in blade file like a regular html tag e.g. ``
- Closing tag is necessary because its a web component.

If you wish to register a custom component and use it within your `blade.php` files, you can do it like so:

#### Step 1: Create a New Custom Component

[](#step-1-create-a-new-custom-component)

Let's create a new Svelte Component (e.g. MyTestComponent.svelte)

```

          My Test Component

            I'm a test component.

```

#### Step 2: Modify The `webpack.mix.js`file

[](#step-2-modify-the-webpackmixjsfile)

Modifiy the `webpack.mix.js` file like so:

```
mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
-   .svelte();
+   .svelte({
+       customElement: true,
+       tag: null // to get rid of "no custom element tag name" warning because we are defining components tag name it in app.js file. otherwise you would have to put "" in all of your custom elements.
+   });
```

#### Step 3: Import the component to your app.js

[](#step-3-import-the-component-to-your-appjs)

Then within your `àpp.js` file, import the MyTestComponent like so:

```
require('./bootstrap');

import App from "./components/App.svelte";
+ import MyTestComponent from "./components/MyTestComponent.svelte";

const app = new App({
  target: document.body
});

window.app = app;

+ customElements.define('my-test-component', MyTestComponent);
export default app;
```

#### Step 4: Convert your App component to a custom component

[](#step-4-convert-your-app-component-to-a-custom-component)

```
require('./bootstrap');

import App from './components/App.svelte';
import MyTestComponent from './components/MyTestComponent.svelte';

+ customElements.define('my-app', App);
customElements.define('my-test-component', MyTestComponent);

- const app = new App({
-     target: document.body,
- });

- window.app = app;
- export default app;
```

#### Step 5: Use the new component in your `blade.php`file

[](#step-5-use-the-new-component-in-your-bladephpfile)

```

        ...

-
+
+

```

Additionally, you may also define the tag within your svelte component instead of with `customElement.define` as so:

``

### Changelog

[](#changelog)

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

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email **** instead of using the issue tracker.

Credits
-------

[](#credits)

- [We Wow Web](https://github.com/wewowweb)
- [Gal Jakic](https://github.com/morpheus7CS)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 97.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~110 days

Recently: every ~204 days

Total

11

Last Release

1440d ago

PHP version history (3 changes)v0.1.0PHP ^7.1

v0.1.3PHP ^7.2

v0.2.1PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9229618e1b419f254b77af5e2e651451acb463d560912643e4a626605c81607a?d=identicon)[morpheus7CS](/maintainers/morpheus7CS)

---

Top Contributors

[![morpheus7CS](https://avatars.githubusercontent.com/u/8884582?v=4)](https://github.com/morpheus7CS "morpheus7CS (42 commits)")[![darethas](https://avatars.githubusercontent.com/u/1624830?v=4)](https://github.com/darethas "darethas (1 commits)")

---

Tags

laravelsvelteWe Wow Weblaravel-svelte-preset

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wewowweb-laravel-svelte-preset/health.svg)

```
[![Health](https://phpackages.com/badges/wewowweb-laravel-svelte-preset/health.svg)](https://phpackages.com/packages/wewowweb-laravel-svelte-preset)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
