PHPackages                             juliomotol/laravel-channel-attributes - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. juliomotol/laravel-channel-attributes

ActiveLibrary[HTTP &amp; Networking](/categories/http)

juliomotol/laravel-channel-attributes
=====================================

This is my package laravel-channel-attributes

v1.0.0(3y ago)17[2 PRs](https://github.com/juliomotol/laravel-channel-attributes/pulls)MITPHPPHP ^8.1

Since Jan 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/juliomotol/laravel-channel-attributes)[ Packagist](https://packagist.org/packages/juliomotol/laravel-channel-attributes)[ Docs](https://github.com/juliomotol/laravel-channel-attributes)[ RSS](/packages/juliomotol-laravel-channel-attributes/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (14)Versions (4)Used By (0)

Laravel Channel Attributes
==========================

[](#laravel-channel-attributes)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8825d3e44141b96af94341611a4e3acdcd7822093d4e8b6349f1c40a158c669b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a756c696f6d6f746f6c2f6c61726176656c2d6368616e6e656c2d617474726962757465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juliomotol/laravel-channel-attributes)[![GitHub Tests Action Status](https://camo.githubusercontent.com/a4e8111a5ff8d45dc281ed4e6fb899320774262ffa933b0655e7c809eeb6f7bb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a756c696f6d6f746f6c2f6c61726176656c2d6368616e6e656c2d617474726962757465732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/juliomotol/laravel-channel-attributes/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/fd04d0b546110d2f6ffd54f0ee3c3fe37a6462a0944ba4741c190e2e6384c098/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a756c696f6d6f746f6c2f6c61726176656c2d6368616e6e656c2d617474726962757465732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/juliomotol/laravel-channel-attributes/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/acb56711f91cfc999ce1f153b382ee73b6f7018c4de6f8fafd68f68aa0b21c99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a756c696f6d6f746f6c2f6c61726176656c2d6368616e6e656c2d617474726962757465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juliomotol/laravel-channel-attributes)

Automatically register channel routes using annotations/attributes!

This package is inspired by [`spatie/laravel-route-attributes`](https://github.com/spatie/laravel-route-attributes).

> Already using `spatie/laravel-route-attributes`? Congrats, time to ditch that `./routes` directory! (Assuming you're not using the `console.php`)

```
use JulioMotol\ChannelAttributes\Attributes\Channel;

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

This will be registered like:

```
Broadcast::channel('foo', FooChannel::class);

```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require juliomotol/laravel-channel-attributes
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-channel-attributes-config"
```

This is the contents of the published config file:

```
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'),
    ],
];
```

Usage
-----

[](#usage)

To add a channel to be registered automatically, simply add the `JulioMotol\ChannelAttributes\Attributes\Channel` to a channel class

CodeWill be interpreted as:```
use JulioMotol\ChannelAttributes\Attributes\Channel;

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

```
Broadcast::channel('foo', FooChannel::class);

```

You can add options to channel by doing:

CodeWill be interpreted as:```
use JulioMotol\ChannelAttributes\Attributes\Channel;

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

```
Broadcast::channel('foo', FooChannel::class, ['guard' => 'web']);

```

You can create a channel for a model by doing:

CodeWill be interpreted as:```
use JulioMotol\ChannelAttributes\Attributes\Channel;
use App\Models\Post;

#[Channel(Post::class)]
class FooChannel
{
    //
}
```

```
Broadcast::channel(Post::class, FooChannel::class);

```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Julio Motol](https://github.com/juliomotol)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1225d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21353103?v=4)[Julio Motol](/maintainers/juliomotol)[@juliomotol](https://github.com/juliomotol)

---

Top Contributors

[![juliomotol](https://avatars.githubusercontent.com/u/21353103?v=4)](https://github.com/juliomotol "juliomotol (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")

---

Tags

annotationsattributesbroadcastingchannelslaravelwebsocketlaraveljuliomotollaravel-channel-attributes

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/juliomotol-laravel-channel-attributes/health.svg)

```
[![Health](https://phpackages.com/badges/juliomotol-laravel-channel-attributes/health.svg)](https://phpackages.com/packages/juliomotol-laravel-channel-attributes)
```

###  Alternatives

[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[sunchayn/nimbus

A Laravel package providing an in-browser API client with automatic schema generation, live validation, and built-in authentication with a touch of Laravel-tailored magic for effortless API testing.

29428.0k](/packages/sunchayn-nimbus)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[nativephp/desktop

NativePHP for Desktop

34020.6k3](/packages/nativephp-desktop)[pdphilip/cf-request

Cloudflare Laravel Request

2725.6k1](/packages/pdphilip-cf-request)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
