PHPackages                             ganyicz/volt-namespace - 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. [Templating &amp; Views](/categories/templating)
4. /
5. ganyicz/volt-namespace

ActiveLibrary[Templating &amp; Views](/categories/templating)

ganyicz/volt-namespace
======================

Adds support for namespaces in Volt

0.0.2(1y ago)36.0k↓50%MITPHPPHP ^8.3CI passing

Since Apr 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ganyicz/volt-namespaces)[ Packagist](https://packagist.org/packages/ganyicz/volt-namespace)[ Docs](https://github.com/ganyicz/volt-namespace)[ GitHub Sponsors](https://github.com/Ganyicz)[ RSS](/packages/ganyicz-volt-namespace/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (14)Versions (3)Used By (0)

Volt Namespaces
===============

[](#volt-namespaces)

This is a (working) proof of concept.

Usage
-----

[](#usage)

Install the package via composer:

```
composer require ganyicz/volt-namespace

```

Mount a new namespace in your VoltServiceProvider:

```
public function boot(): void
{
    Volt::mount([
        config('livewire.view_path', resource_path('views/livewire')),
        resource_path('views/pages'),
    ]);

+   VoltNamespace::mount('admin', resource_path('views/admin/livewire'));
}
```

Use the namespace when rendering a volt component:

```

```

The above will load a volt component from the following path:

```
/resources/views/admin/livewire/search-users.blade.php

```

Why
---

[](#why)

Using namespaces allows for a cleaner directory structure when maintaining multiple frontends in one repo. With Blade, we can already register a namespace for anonymous components like this:

```
Blade::anonymousComponentPath(resource_path('views/admin/components'), 'admin');

```

Combined, this allows us to have the following structure that keeps all related views together, including livewire, blade components and regular views:

```
resources
└─ views
  └─ admin
    └─ auth
    └─ pages
    └─ livewire
    └─ components

```

Whereas *without* namespaces, we would have to use subdirectories, which fragments the structure:

```
resources
└─ views
  └─ admin
    └─ auth
    └─ pages
  └─ components
    └─ admin
  └─ livewire
    └─ admin

```

Disclaimer
----------

[](#disclaimer)

This packge has only been tested in a single project with a specific setup and alters core functionalities of Laravel and Volt. This could have unintended consequences in your app. Use at your own risk.

If this functionality were to be added to the core of Volt, this could be achieved with a lot less hackery.

How it works
------------

[](#how-it-works)

1. It binds a custom view finder that extends the `Illuminate\View\FileViewFinder`. This is required to load the correct view in the namespaced components.

    Volt uses a custom `volt-livewire` view namespace that contains all mounted paths and when a component is rendered it will try to load the following view for ``:

    ```
    volt-livewire::search-users

    ```

    The first part is the custom view namespace and the second part is the component name that Volt will look for in all mounted paths. In our case the name of the component would contain the "sub-namespace" like this:

    ```
    volt-livewire::admin:search-users

    ```

    The package simply moves the primary namespace separator like this:

    ```
    volt-livewire:admin::search-users

    ```

    Where `volt-livewire:admin` is a new view namespace that is registered by the pacakge when a volt namespace is mounted. This namespace contains the paths defined by the user in `VoltNamespace::mount()` method.
2. It replaces the `Livewire\Volt\Precompilers\ExtractTemplate` precompiler to include the registered namespaced directories in the pre-compilation process.

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Filip Ganyicz](https://github.com/ganyicz)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance47

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

393d ago

PHP version history (2 changes)0.0.1PHP ^8.4

0.0.2PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/01cfffb593c2e79d752f1df4099b816cf93419a61d4d9ebcca66675bdae4e450?d=identicon)[ganyicz](/maintainers/ganyicz)

---

Top Contributors

[![ganyicz](https://avatars.githubusercontent.com/u/3823354?v=4)](https://github.com/ganyicz "ganyicz (6 commits)")

---

Tags

laravelganyiczvolt-namespace

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ganyicz-volt-namespace/health.svg)

```
[![Health](https://phpackages.com/badges/ganyicz-volt-namespace/health.svg)](https://phpackages.com/packages/ganyicz-volt-namespace)
```

###  Alternatives

[ryangjchandler/blade-capture-directive

Create inline partials in your Blade templates with ease.

8222.2M12](/packages/ryangjchandler-blade-capture-directive)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[spatie/laravel-blade-comments

Add debug comments to your rendered output

177325.5k](/packages/spatie-laravel-blade-comments)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[daikazu/laravel-glider

Start using Glide on-the-fly instantly in your Laravel blade templates.

882.3k](/packages/daikazu-laravel-glider)

PHPackages © 2026

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