PHP code example of davidgut / boson

1. Go to this page and download the library: Download davidgut/boson 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/ */

    

davidgut / boson example snippets


use DavidGut\Boson\Toast;

Toast::show('Something happened.');
Toast::success('Saved successfully!');
Toast::warning('Check your input.', 'Heads up');
Toast::danger('Something went wrong.');

return response()->json([
    'data' => ['team' => ['name' => 'Acme']]
]);
js
$toast.show('Something happened.');
$toast.success('Saved!');
$toast.warning({ heading: 'Heads up', text: 'Check your input.' });
$toast.danger({ heading: 'Error', text: 'Something went wrong.', duration: 8000 });
blade
<x-boson::form async action="/users" method="POST">
blade
<x-boson::combobox name="user" async="/api/users" placeholder="Search users..." />

<x-boson::listbox name="user" async="/api/users" searchable placeholder="Search users..." />
blade
<form on:success="$toast.success('Saved!')">
<button on:click="$toast.danger({ heading: 'Error', text: 'Something went wrong.' })">
js
import { $events } from '../../vendor/davidgut/boson/resources/js/boson.js';

$events.register('myevent');        // custom (dispatched as boson:myevent)
$events.register('scroll', true);   // native
blade
<x-boson::link href="/legacy" :turbo="false">Legacy Page</x-boson::link>
<x-boson::form action="/upload" method="POST" :turbo="false">...</x-boson::form>
bash
php artisan boson:rules
bash
php artisan vendor:publish --tag=boson-config
bash
php artisan vendor:publish --tag=boson-views