Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/frozzare/php-redirects
- Owner: frozzare
- License: mit
- Created: 2019-01-14T19:24:20.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-08T09:48:38.000Z (about 5 years ago)
- Last Synced: 2024-11-11T14:58:23.492Z (3 months ago)
- Topics: netlify, parser, php, redirects
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
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)