Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/me-shaon/simple-livewire-demo
A simple example to show how we can broadcast Laravel event to Livewire component and show the result in real-time
https://github.com/me-shaon/simple-livewire-demo
Last synced: 21 days ago
JSON representation
A simple example to show how we can broadcast Laravel event to Livewire component and show the result in real-time
- Host: GitHub
- URL: https://github.com/me-shaon/simple-livewire-demo
- Owner: me-shaon
- Created: 2023-12-30T11:00:19.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-12-30T11:01:58.000Z (12 months ago)
- Last Synced: 2024-10-15T23:36:43.165Z (2 months ago)
- Language: PHP
- Size: 505 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![Demo screenshot](./demo-screenshot.png)
## Livewire real-time event listening demo
This is a simple example to show how we can broadcast Laravel event to Livewire component and show the result in real-time.
Here we'll see how we can send a real-time event to a browser page when we update some data from Console command.
### How to run
Run the following commands to install the project:
``` shell
composer install
npm install
sail up -d
sail artisan migrate --seed
npm run dev
```The `APP_PORT` is set to `9999`, so you'll be able to run the project at `http://localhost:9999` in the browser. Feel free to change it if you want.
You need to create an API key in a project in [ably](https://ably.com/). Set it to `ABLY_KEY` in `.env` file.
Now open up the terminal and run `sail artisan app:change-weather` command.
It'll prompt for some information. If you feel it up, you'll see that the weather information in your browser page updated automatically.