Download the PHP package ganyicz/volt-namespace without Composer

On this page you can find all versions of the php package ganyicz/volt-namespace. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package volt-namespace

Volt Namespaces

This is a (working) proof of concept.

Usage

Install the package via composer:

Mount a new namespace in your VoltServiceProvider:

Use the namespace when rendering a volt component:

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

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:

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

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

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

  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 <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:

    The package simply moves the primary namespace separator like this:

    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

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of volt-namespace with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^10.0||^11.0||^12.0
livewire/livewire Version ^3.6
livewire/volt Version ^1.7
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ganyicz/volt-namespace contains the following files

Loading the files please wait ....