Download the PHP package phattarachai/task-runs-laravel without Composer

On this page you can find all versions of the php package phattarachai/task-runs-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package task-runs-laravel

Task Runs for Laravel

Latest Version on Packagist Tests Code Style PHP Version Laravel Version Total Downloads

In-app background-task status tracking. Every opt-in job records a row in task_runs, so you can watch live progress and review run history inside your app — Horizon tells you a job was delivered; this tells you what it did: 7,412 of 13,798 rows processed, cancel requested, resumed after a deploy, failed with this message, three days ago.

Install

The migration loads from the package; publish it instead with --tag=task-runs-migrations if you need to edit it.

Register your tasks

Dispatch through the dispatcher — UI, CLI, and scheduler all use the same entry point:

If a run of the same type + subject is already queued or running, you get that run back instead of a duplicate — unless it sat idle past orphan_grace_seconds on an empty queue, in which case it is failed and superseded.

Report from the job — pick a level

Level 1 — the trait, for jobs with real progress. It provides the public TaskRun $taskRun constructor the dispatcher relies on, the failed() hook, and a queued-cancel guard. Progress stays manual, because only the job knows what a chunk is:

Narrate the run: reportProgress()

message holds one headline; reportProgress() appends to a trail of {at, line} entries — the story of the run, for a feed the user can open and read:

Each append re-reads the row under a row lock, so two writers can't lose each other's line, and it moves no counter — narration and advance() are independent. progress_limit (default 200) caps the trail; the oldest lines fall off, and the whole thing goes away with the row when the run is pruned. It rides in snapshot(), so the poll payload, the resource, and the status broadcast all carry it already:

Log what the run asked: recordRequest()

recordRequest(array $manifest) stores a JSON payload on the row's nullable request column — the prompt and call parameters a producer wants to keep for reproducibility (claude-tasks writes its RunManifest here). Unlike progress, it is deliberately held out of snapshot(): it can be large and only a detail view needs it, so read it straight off the row when you open one, never on every poll frame.

Level 2 — the middleware, for start/finish-only jobs. No lifecycle calls in handle() at all:

Level 3 — nothing. Jobs that don't opt in are completely untouched.

Multi-hour jobs: Interruptible

A job that runs for hours never returns to the worker's between-jobs restart check, so a deploy's queue:restart / horizon:terminate would kill it mid-flight — and a backlog bigger than the worker timeout dies at the ceiling. Interruptible lets the job notice both and hand the worker back, keeping its progress:

Queues and connections

When a map isn't expressive enough, register a resolver in a service provider:

The HTTP contract

Routes mount under task-runs.routes.prefix (default tasks) behind ['web', 'auth']:

Route Returns
GET /tasks/poll {active: [...], history: [...], horizon: {status, masters}}
POST /tasks/run/{type} dispatches a whitelisted type, returns the run snapshot
POST /tasks/{id}/cancel requests cooperative cancel (a queued run is cancelled outright)
GET /tasks the Inertia page — registered only when inertia-laravel is installed

runnable whitelists what the run endpoint may fire (null = every configured type). horizon.status degrades to unavailable when Horizon isn't installed and unknown when Redis is unreachable — the package never requires Horizon.

The bundled page (optional)

The package ships a neutral Inertia/React tasks page: active runs with progress bars and cancel buttons, history, a worker-health pill, and a run button per whitelisted type. Styling is plain CSS scoped under .tr-root with --tr-* tokens (dark under a .dark ancestor) — no Tailwind coupling, re-skin by overriding tokens.

Only the page stub lands in your tree (import.meta.glob never leaves ./pages); the module itself is reached through a Vite alias, so there is no second copy to drift. In vite.config.js:

Then npm run build and open /tasks. If your pages live in a capitalised resources/js/Pages/, move the published stub there. Skip all of this to stay headless — useTaskPoll and the JSON contract work with any UI:

Live updates (optional)

With broadcasting off (the default) the page polls every 2s while anything is active and stops when the queue drains. Turn on task-runs.broadcast.enabled and every lifecycle write broadcasts TaskRunStatusChanged on the configured channel (default: private task-runs) — the page then refreshes per frame and only falls back to polling while the socket is down. Authorize the channel in your routes/channels.php:

reportProgress() broadcasts too, as TaskRunProgress — but on a channel per run, task-runs.{id}, because a feed drawer open on one run has no business receiving another run's narration. The frame carries {id, status, entry: {at, line}}, so a listener can append without refetching:

The bundled page's client config hands you the pattern as broadcast.run_channel (task-runs.__ID__), so the channel name is never hardcoded twice.

Pruning

Neither of this package's ancestors pruned, and their tables grew forever. Set retention_days and finished runs older than that are removed daily via model:prune (the scheduler entry is registered for you). Active runs are never pruned; null keeps everything.

Extending the model

Point task-runs.model at your own subclass to add relations, labels, or columns:

Config reference

See config/task-runs.php — every key is documented inline. The essentials:

Key Default
jobs [] type → job class map
queues / default_queue [] / null per-type queue routing
connections [] queue → connection map, '*' fallback
orphan_grace_seconds 60 idle window before an empty queue means the job is gone (null disables)
retention_days null prune finished runs after N days
history_limit 30 rows in the history section
progress_limit 200 ceiling on the narration trail per run (null = unbounded)
runnable null whitelist for POST /tasks/run/{type}
broadcast.enabled false fire TaskRunStatusChanged on lifecycle writes and TaskRunProgress on narration
routes.prefix / routes.middleware tasks / ['web', 'auth'] where and behind what it mounts
ui.enabled / ui.page true / TaskRuns the Inertia index route and component name

Testing

Credits

Extracted from the task systems running in two production apps — the vault media library (which contributed the orphan guard and Interruptible) and the music library (which contributed the broadcast path and the single snapshot() wire shape).

License

MIT — see LICENSE.md.

ผู้พัฒนา

พัฒนาและดูแลโดย บริษัท ภัทรชัย อาร์ทิซาน จำกัด (Phattarachai Artisan) บริษัทที่ปรึกษาและพัฒนาเว็บ ที่เรียนรู้และแบ่งปันกับชุมชน Laravel แพ็กเกจนี้แบ่งปันให้ชุมชนนำไปใช้และต่อยอดได้อย่างอิสระ

ดูแพ็กเกจอื่นของเราได้ที่ phattarachai.dev/open-source และติดต่อเราได้ที่ phattarachai.dev


All versions of task-runs-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/broadcasting Version ^12.0 || ^13.0
illuminate/bus Version ^12.0 || ^13.0
illuminate/contracts Version ^12.0 || ^13.0
illuminate/database Version ^12.0 || ^13.0
illuminate/http Version ^12.0 || ^13.0
illuminate/queue Version ^12.0 || ^13.0
illuminate/routing Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phattarachai/task-runs-laravel contains the following files

Loading the files please wait ...