Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/frozzare/php-redirects

Parse Netlify's _redirects file format.
https://github.com/frozzare/php-redirects

netlify parser php redirects

Last synced: 27 days ago
JSON representation

Parse Netlify's _redirects file format.

Awesome Lists containing this project

README

        

# Redirects

[![Build Status](https://travis-ci.org/frozzare/php-redirects.svg?branch=master)](https://travis-ci.org/frozzare/php-redirects)

Parse Netlify's _redirects file [format](https://www.netlify.com/docs/redirects/).

## Installation

```
composer require frozzare/redirects
```

## Usage

```php
use Frozzare\Redirects\Redirects;

// or redirects() function.
$redirects = new Redirects(__DIR__ . '/_redirects');

// return array of rules.
$redirects->rules();

// match url against rule.
$redirects->match($url);

// get url to redirect to.
$redirects->url($url);
```

More examples in the [`tests/RedirectsTest.php`](tests/RedirectsTest.php)

## License

MIT © [Fredrik Forsmo](https://github.com/frozzare)