Easily implement broadcasting in a React/Vue Typescript app (Starter Kits)#55170
Merged
Conversation
|
Thanks for submitting a PR! Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
Member
|
Drafting this while I review. |
Contributor
Author
|
I've updated this PR to only include the configureEcho functionality when installing in a React/Vue(typescript) app. The actual javascript functionality and hooks have been moved over to this PR. The updated version of Echo should be published before merging this. |
…ework into pr/tnylea/55170
crynobone
reviewed
May 13, 2025
| /** | ||
| * Write an array of key-value pairs to the environment file. | ||
| * | ||
| * @param array $variables |
Member
There was a problem hiding this comment.
Suggested change
| * @param array $variables | |
| * @param array<string, mixed> $variables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is going to make the process of implementing broadcasting in the React/Vue starter kits super simple.
This PR will detect if a users application utilizes
reactorvue. It will also check for the existense of thetypescriptdependency. Then, when the developer runs thephp artisan install:broadcastingcommand it will install the necessary Echo hook or composable.React
Running
php artisan install:broadcasting, theuse-echo-ts.stubwill be installed in theresources/js/hooksfolder. It can then be leveraged inside of any component, like so:This will subscribe to
test-channeland log the payload whentest.eventis fired.Vue
Running
php artisan install:broadcasting, theuseEcho-ts.stubwill be installed in theresources/js/composablesfolder. It can then be leveraged inside of any component, like so:This is the exact same as React except the
useEchois stored in thecomposablesfolder as opposed to thehooksfolder.Configuration
Before using this hook/composable, echo needs to be configured, like so:
app.tsx
This will allow developers to modify echo to use
reverb,pusher,ablyor any other websocket service. This is going to be added by default (Still adding this functionality to theinstall:broadcastingcommand. After I finish implementing the publishing of the configure, this update will be good to go!