PHPackages                             sinemacula/laravel-async-polling - 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. sinemacula/laravel-async-polling

AbandonedArchivedLibrary

sinemacula/laravel-async-polling
================================

A simple polling trait, designed to extend Laravel's queued jobs with asynchronous polling

v1.0.1(2y ago)12[1 PRs](https://github.com/sinemacula/laravel-async-polling/pulls)Apache-2.0PHPPHP ^8.2CI passing

Since Jan 29Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/sinemacula/laravel-async-polling)[ Packagist](https://packagist.org/packages/sinemacula/laravel-async-polling)[ RSS](/packages/sinemacula-laravel-async-polling/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

Laravel Async Polling
=====================

[](#laravel-async-polling)

[![Build Status](https://github.com/sinemacula/laravel-async-polling/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/sinemacula/laravel-async-polling/actions/workflows/tests.yml)[![StyleCI](https://camo.githubusercontent.com/b3f990bdc8126b0273f9f29250788b095c748bb4d39d45098803f9a8ac909075/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3734393033353537302f736869656c643f7374796c653d666c6174266272616e63683d6d6173746572)](https://github.styleci.io/repos/749035570)[![Maintainability](https://camo.githubusercontent.com/6b2664a7099b4705a020e29d5b45f2963d27f847bfeeeefb5c1f1a93b25937a5/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f61366665633064323866636238393031656533352f6d61696e7461696e6162696c697479)](https://codeclimate.com/repos/65b4f3033f0d085ad7ff02c2/maintainability)[![Test Coverage](https://camo.githubusercontent.com/5c58d25605deba4cc0a7fc05b258824e5729156970bd99f5970a0d77e3ab1690/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f61366665633064323866636238393031656533352f746573745f636f766572616765)](https://codeclimate.com/repos/65b4f3033f0d085ad7ff02c2/test_coverage)

This repository provides a simple polling trait, designed to extend Laravel's queued jobs with asynchronous polling capabilities. It's a straightforward solution for jobs that require repeated checks or waiting for specific conditions before proceeding.

Features
--------

[](#features)

- **Effortless Integration**: Add polling functionality to any Laravel job with just one trait.
- **Customizable Polling Logic**: Implement your own polling logic with abstract methods.
- **Resource Efficient**: Smart handling of execution time and memory limits.

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

[](#installation)

Install the package via Composer:

```
composer require sinemacula/laravel-async-polling
```

Usage
-----

[](#usage)

1. **Use the Trait in Your Job Class**: Import and use HandlesPolling in your Laravel job.

```
use SineMacula\Jobs\Traits\HandlesPolling;

class ExampleJob implements ShouldQueue
{
    use HandlesPolling;

    // Implement required abstract methods (see Step 2)
}
```

2. **Implement Abstract Methods**: Provide implementations for abstract methods defined in the trait to tailor the polling process.

```
/**
 * Get the id to uniquely identify the polling job.
 *
 * @return string
 */
protected function getPollingId(): string
{
    // Return a unique identifier for the polling job

    // Example:
    return $this->uniqueId();
}

/**
 * Determine whether the polling job has resolved.
 *
 * @return bool
 */
protected function hasPollResolved(): bool
{
    // Return true if the polling job has successfully resolved

    // Example:
    return $this->isStatusFinite($this->status);
}

/**
 * Resolve the polling job to be dispatched.
 *
 * @return \Illuminate\Contracts\Queue\ShouldQueue
 */
protected function resolvePollingJob(): ShouldQueue
{
    // Resolve the job to be released back to the queue. This function will
    // most likely just return `new static` but it is here to allow for new
    // parameters to be passed to the next instance of the poll. This method
    // will only be executed when job release is not supported.

    // Example:
    return new static($this->status);
}

/**
 * Resolve the poll.
 *
 * @return bool
 */
protected function resolvePoll(): bool;
{
    // Here is where you insert the logic for the actual poll

    // Example
    $response = SomethingCool::getStatus($this->someProperty);

    $this->someCustomMethod($response);

    return $this->hasPollResolved();
}
```

3. **Customisation Configuration**: If you would like to override certain configurations, you can do so by defining any of the following methods:

```
/**
 * Determine whether jobs can be released.
 *
 * @return bool
 */
protected function canJobsBeReleased(): bool
{
    return config('some.configuration', self::SUPPORTS_JOB_RELEASE);
}

/**
 * Get the interval of the poll.
 *
 * @return int
 */
protected function getInterval(): int
{
    return config('some.configuration', self::DEFAULT_INTERVAL);
}

/**
 * Get the maximum allowed number of attempts.
 *
 * @return int
 */
protected function getMaxAttempts(): int
{
    return config('some.configuration', self::DEFAULT_MAX_ATTEMPTS);
}

/**
 * Get the maximum lifetime of the poll.
 *
 * @return int
 */
protected function getLifetime(): int
{
    return config('some.configuration', self::DEFAULT_LIFETIME);
}
```

License
-------

[](#license)

The Laravel Async Polling repository is open-sourced software licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance54

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Every ~0 days

Total

2

Last Release

834d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6262ea965c244b0c946a2f29a94da05e30846c066a0b59399466216654c78fe6?d=identicon)[sinemacula](/maintainers/sinemacula)

---

Top Contributors

[![sinemacula-ben](https://avatars.githubusercontent.com/u/118753672?v=4)](https://github.com/sinemacula-ben "sinemacula-ben (15 commits)")

---

Tags

laravelqueuessine maculapolling

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sinemacula-laravel-async-polling/health.svg)

```
[![Health](https://phpackages.com/badges/sinemacula-laravel-async-polling/health.svg)](https://phpackages.com/packages/sinemacula-laravel-async-polling)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[spatie/laravel-ignition

A beautiful error page for Laravel applications.

566146.7M471](/packages/spatie-laravel-ignition)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)

PHPackages © 2026

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