Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Wireuse Laravel Package

foxws/wireuse

View on GitHub
Deep Wiki
Context7

title: Structure Scout order: 4 tags:

  • livewire
  • components
  • strucutures

Introduction

If you have a lot of Blade or Livewire components, it may take a lot of work to register them manually, especially in multi-tenancy applications.

The component scout can help with this. It is supported by spatie/php-structure-discoverer package, which also offers benefits such as caching.

It is recommend to use a domain-driven-design (DDD) pattern, such as src/App/Posts/Components/Card.php. Spatie offers an excellent in dept course about DDD.

Configuration

Structure Scout is disabled by default, and can be enabled in config/wireuse.php:

php artisan vendor:publish --tag="wireuse-config"
'scout' => [
    'enabled' => true,

    'cache_store' => null,

    'cache_lifetime' => 60 * 60 * 24 * 7,
],

Blade Components

To auto-discover Blade components, create and register a service provider:

php artisan make:provider ViewServiceProvider
use Foxws\WireUse\Scout\ComponentScout;
use Illuminate\Support\ServiceProvider;

class ViewServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        $this->registerComponents();
    }

    protected function registerComponents(): static
    {
        ComponentScout::create(app_path('Web'), 'App\\')->register();

        return $this;
    }
}

To call a registered Blade component:

<x-web.posts.card :$item />

Livewire Components

To discover Livewire components, create and register a service provider:

php artisan make:provider LivewireServiceProvider
use Foxws\WireUse\Scout\LivewireScout;
use Illuminate\Support\ServiceProvider;

class LivewireServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        $this->registerComponents();
    }

    protected function registerComponents(): static
    {
        LivewireScout::create(app_path('Web'), 'App\\')->register();

        return $this;
    }
}

To call a registered Livewire component:

<livewire:web.posts.tags />
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope