PHP code example of juliomotol / laravel-channel-attributes

1. Go to this page and download the library: Download juliomotol/laravel-channel-attributes 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/ */

    

juliomotol / laravel-channel-attributes example snippets


use JulioMotol\ChannelAttributes\Attributes\Channel;

#[Channel('foo')]
class FooChannel
{
    //
}

return [
    /*
     *  Automatic registration of channels will only happen if this setting is `true`
     */
    'enabled' => true,

    /*
     * Channels in these directories that have channel attributes will automatically be registered.
     * You can specify a different namespace other than `\App` by providing a different key.
     *
     * e.g ['\Domain\Post\Broadcasting' => base_path('domain/Post/Broadcasting')]
     */
    'directories' => [
        app_path('Broadcasting'),
    ],
];

use JulioMotol\ChannelAttributes\Attributes\Channel;

#[Channel('foo')]
class FooChannel
{
    //
}

use JulioMotol\ChannelAttributes\Attributes\Channel;

#[Channel('foo', ['guard' => 'web'])]
class FooChannel
{
    //
}

use JulioMotol\ChannelAttributes\Attributes\Channel;
use App\Models\Post;

#[Channel(Post::class)]
class FooChannel
{
    //
}
bash
php artisan vendor:publish --tag="laravel-channel-attributes-config"