PHPackages                             pnz/tus-hook-handler - 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. pnz/tus-hook-handler

AbandonedArchivedLibrary

pnz/tus-hook-handler
====================

1171PHP

Since Apr 25Pushed 8y agoCompare

[ Source](https://github.com/thePanz/php-tus-hook-handler)[ Packagist](https://packagist.org/packages/pnz/tus-hook-handler)[ RSS](/packages/pnz-tus-hook-handler/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

TUS hook handler for PHP
========================

[](#tus-hook-handler-for-php)

Quick helper to handle TUSd HTTP hooks. The handler exposes two methods to process the hook data and to dispatch TUSd events by using and EventDispatcher.

Example of triggered events:

- `tus.hook.pre-create`: Pre create event ()
- `tus.hook-post-create`: Post crete event (see: )
- `tus.hook-post-finish`: Post finish event (see: )
- `tus.hook-post-receive`: Post receive event (see: )
- `tus.hook-post-terminate`: Post terminate event (see: )

Due to the TUSd hook implementation, your controller *MUST* respond with a proper response to the `pre-create` http hook, to confirm the upload (response code 200), or to deny it (response code 400).

Example of the hook controller:

```
    public function tusdHookAction(Request $request): Response
    {
        try {
            $data = $this->tusHookHandler->buildHookData($request);
        } catch (TusException $e) {
            // Do not proceed, as the the request is invalid.
            // The TUSd server will abort the upload
            return new Response('Invalid request: '.$e->getMessage(), 400);
        }

        if (HookData::HOOK_PRE_CREATE === $data->hookName) {
            if (!$this->isValidUpload($data)) {
                // Return a failure response, TUSd server will abort the upload
                return new Response('Invalid request: invalid token', 400);
            }
        }

        // Let the handler dispatch the event
        $this->tusHookHandler->handleHook($data);

        // Return an empty response, TUSd server will handle it as a positive answer.
        return new Response();
    }

    private function isValidUpload(HookData $data): bool
    {
      ...
    }
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a788c96bbcf89371ff0c614ad9f1655363369cb8e17ffd7afbebf046da6dad8?d=identicon)[thepanz](/maintainers/thepanz)

---

Top Contributors

[![thePanz](https://avatars.githubusercontent.com/u/226021?v=4)](https://github.com/thePanz "thePanz (4 commits)")

### Embed Badge

![Health badge](/badges/pnz-tus-hook-handler/health.svg)

```
[![Health](https://phpackages.com/badges/pnz-tus-hook-handler/health.svg)](https://phpackages.com/packages/pnz-tus-hook-handler)
```

PHPackages © 2026

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