Download the PHP package yogameleniawan/realtime-job-batching without Composer
On this page you can find all versions of the php package yogameleniawan/realtime-job-batching. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yogameleniawan/realtime-job-batching
More information about yogameleniawan/realtime-job-batching
Files in yogameleniawan/realtime-job-batching
Package realtime-job-batching
Short Description Job Batching with Realtime Progress using Pusher for Laravel
License MIT
Informations about the package realtime-job-batching
Laravel Job Batching with Realtime Progress
Preview Realtime Job Batching
List of Contents
- Laravel Job Batching with Realtime Progress
- Preview Realtime Job Batching
- List of Contents
- Requirement
- Configuration
- Migration Table
- Install Package
- Pusher Configuration
- Implementation
- Create Service Repository
- Create Controller Function
- Setup javascript
- Changelog
- Credits
- License
Requirement
Configuration
Migration Table
-
Make migration job table
-
Make migration job batches table
- Migrate table
Install Package
Pusher Configuration
-
Install Pusher PHP SDK
- Create Channels App Create Channel Pusher
- Setting Up your .env for pusher variable
Implementation
Create Service Repository
- Create repository class on
your_project\app\Repositories
For example:VerificationRepository.php
.
So now you have repository class your_project\app\Repositories\VerificationRepository.php
- Add
implements RealtimeJobBatchInterface
in your Repository Class - Don't forget to import interface
use YogaMeleniawan\JobBatchingWithRealtimeProgress\Interfaces\RealtimeJobBatchInterface;
-
The interface has 2 methods. So, you should implement these methods :
public function get_all(): Collection
In this function you can get all data from your database and return it into Collection. Why you should return into Collection? First of all, the data will be looping with foreach method and then add one by one into job and then the process will executed one by one.public function save($data): void
In this function you can make your own business logic to update/delete/something else that you want. So, this function doesn't have any return data that's why this function must be void type. - This is the example of Repository Class
Create Controller Function
- Create function to handle your job process For example :
VerificationRepository()
is your service repository that you have created before so don't forget to import this class use App\Repositories\VerificationRepository;
- Explanation about RealtimeJobBatch methods :
setRepository(RealtimeJobBatchInterface $repository):object
is method to implement your repository class that you want to use and return to object. So, you can useRealtimeJobBatch
class in another service with different repository.execute($name): object
is method to execute job service with your custom name that you want. This method will return object.
Setup javascript
- Add this script to your view (blade). For another view (React/Vue/Etc) you can check out from this link Setup Pusher
-
Script Blade :
- Response from Pusher :
Changelog
Please see CHANGELOG for more information what has changed recently.
Credits
- Yoga Meleniawan Pamungkas
- All Contributors
License
The MIT License (MIT). Please see License File for more information.