PHPackages                             michaelbiberich/turbolinks-location-middleware - 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. michaelbiberich/turbolinks-location-middleware

ActiveLibrary

michaelbiberich/turbolinks-location-middleware
==============================================

PSR-15 compliant implementation of MiddlewareInterface to insert Turbolinks-Location header into every response

1.0.0(5y ago)110BSD-3-ClausePHPPHP &gt;=7.4

Since Aug 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/michaelbiberich/turbolinks-location-middleware)[ Packagist](https://packagist.org/packages/michaelbiberich/turbolinks-location-middleware)[ RSS](/packages/michaelbiberich-turbolinks-location-middleware/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

PSR-15 Turbolinks-Location Middleware *(michaelbiberich/turbolinks-location-middleware)*
========================================================================================

[](#psr-15-turbolinks-location-middleware-michaelbiberichturbolinks-location-middleware)

[![standard-readme compliant](https://camo.githubusercontent.com/4d148b38f9c13f71b15b80f0bd583698fd5a5ab9bd7dfe61d40e1e30aec35399/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f726561646d652532307374796c652d7374616e646172642d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/RichardLitt/standard-readme)[![PDS Skeleton](https://camo.githubusercontent.com/50d01a5094afcc3a827c3cadaec43d23b2a256cb249f5fdd6e5ffdb53ea7971c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7064732d736b656c65746f6e2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/php-pds/skeleton)[![Latest version on Packagist](https://camo.githubusercontent.com/07fa1a66f6d02fc0d498a8c2a4a78b390f8694f20b389111a33f5159cb6f196e/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d69636861656c62696265726963682f747572626f6c696e6b732d6c6f636174696f6e2d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/michaelbiberich/turbolinks-location-middleware)

> PSR-15 compliant implementation of MiddlewareInterface to insert Turbolinks-Location header into every response

See the [Turbolinks documentation on following redirects](https://github.com/turbolinks/turbolinks#following-redirects).

Inspired by [code-orange/turbolinks-location](https://packagist.org/packages/code-orange/turbolinks-location).

Table of Contents
-----------------

[](#table-of-contents)

- [Install](#install)
    - [Tests](#tests)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)

Install
-------

[](#install)

Add **turbolinks-location-middleware** as a dependency to your project with [composer](https://getcomposer.org/).

```
composer require michaelbiberich/turbolinks-location-middleware ^1

```

### Tests

[](#tests)

Tests can be run using [PHPUnit](https://phpunit.de/), see [phpunit.xml.dist](https://github.com/michaelbiberich/turbolinks-location-middleware/blob/HEAD/phpunit.xml.dist).

```
phpunit --configuration ./phpunit.xml.dist

```

Code Coverage can be reported as well, eg by using [PHPDBG](https://www.php.net/manual/en/book.phpdbg.php).

```
phpdbg -qrr ./vendor/bin/phpunit --coverage-text

```

Composer scripts are available for both tasks.

```
composer test
composer coverage

```

> A quick way to run these without installing composer can be achieved by using the official [composer Docker Image](https://hub.docker.com/_/composer/).
>
> Eg `docker run --rm --interactive --tty --volume $PWD:/app composer coverage`

Usage
-----

[](#usage)

Create a new instance of `TurbolinksLocationMiddleware` and Add it to your dispatcher/route handler/pipe:

```
