PHP code example of emaia / laravel-hotwire

1. Go to this page and download the library: Download emaia/laravel-hotwire library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

emaia / laravel-hotwire example snippets


// Example: return Turbo Streams
return turbo_stream()
    ->append('messages', view('messages.item', compact('message')))
    ->remove('modal');

stimulus();
stimulus_controller($name, $values = [], $classes = [], $outlets = []);
stimulus_action($controller, $method, $event = null, $params = []);
stimulus_target($controller, $target);

// config/hotwire.php

return [
    'prefix' => 'hwc', // <x-hwc::modal>
];

'modal' => [
    'class' => \Emaia\LaravelHotwire\Components\Modal::class,
    'view' => 'hotwire::component-views.modal',
    'docs' => 'docs/components/modal.md',
    'category' => 'overlay',
    'controllers' => ['modal'],
],

'tooltip' => [
    'source' => 'resources/js/controllers/tooltip_controller.js',
    'docs' => 'docs/controllers/tooltip.md',
    'category' => 'utility',
    'npm' => ['tippy.js' => '^6.3.7'],
],
bash
php artisan vendor:publish --tag=hotwire-config
bash
php artisan hotwire:install
bash
# Overwrite existing files without prompting
php artisan hotwire:install --force

# Install only JS or CSS scaffolding
php artisan hotwire:install --only=js
php artisan hotwire:install --only=css
bash
php artisan hotwire:docs
bash
php artisan hotwire:docs auto-submit
php artisan hotwire:docs turbo/progress
php artisan hotwire:docs modal --component
bash
php artisan hotwire:docs --list
php artisan hotwire:docs --list --controller
php artisan hotwire:docs --list --component
bash
php artisan hotwire:controllers auto-select auto-submit turbo/progress
bash
php artisan hotwire:controllers
bash
php artisan hotwire:controllers auto-select
bash
php artisan hotwire:controllers turbo
bash
php artisan hotwire:controllers modal turbo/progress auto-submit
bash
php artisan hotwire:controllers --list
bash
php artisan hotwire:controllers auto-select --force
bash
php artisan hotwire:components
bash
php artisan hotwire:check
bash
# Auto-publish missing/outdated controllers AND add missing npm deps to devDependencies
php artisan hotwire:check --fix

# Also run the detected package manager install command after adding deps
php artisan hotwire:check --fix --install

# Scan a custom path
php artisan hotwire:check --path=resources/views/app
bash
php artisan vendor:publish --tag=hotwire-views
css
@source '../../vendor/emaia/laravel-hotwire/resources/views/**/*.blade.php';
@custom-variant turbo-preview (html[data-turbo-preview] &);
@custom-variant turbo-visit (html[aria-busy="true"] &);
@custom-variant form-busy (form[aria-busy="true"] &);
@custom-variant frame-busy (turbo-frame[busy] &);
@custom-variant in-turbo-frame (turbo-frame &);
@custom-variant in-remote-turbo-frame (turbo-frame[src] &);
@custom-variant modal ([data-modal-target="dialog"] &);