Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/00f100/fcphp-route
Package to manipulate routes
https://github.com/00f100/fcphp-route
fcphp http php7 php72 request route
Last synced: about 2 months ago
JSON representation
Package to manipulate routes
- Host: GitHub
- URL: https://github.com/00f100/fcphp-route
- Owner: 00F100
- License: mit
- Created: 2018-07-21T16:30:40.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-04T20:49:53.000Z (almost 6 years ago)
- Last Synced: 2024-11-13T22:14:46.978Z (about 2 months ago)
- Topics: fcphp, http, php7, php72, request, route
- Language: PHP
- Size: 29.3 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FcPHP Route
Package do manage routes into FcPhp
[![Build Status](https://travis-ci.org/00F100/fcphp-route.svg?branch=master)](https://travis-ci.org/00F100/fcphp-route) [![codecov](https://codecov.io/gh/00F100/fcphp-route/branch/master/graph/badge.svg)](https://codecov.io/gh/00F100/fcphp-route) [![Total Downloads](https://poser.pugx.org/00F100/fcphp-route/downloads)](https://packagist.org/packages/00F100/fcphp-route)
## How to install
Composer:
```sh
$ composer require 00f100/fcphp-route
```or composer.json
```json
{
"require": {
"00f100/fcphp-route": "*"
}
}
```## How to use
After match route (same 404, 403) return instance of [FcPhp\Route\Entity](https://github.com/00F100/fcphp-route/blob/master/src/Interfaces/IEntity.php)
```php
match('GET', 'v1/users/10');// Print: FcPhp\Route\Entity
echo get_class($match);// Print: 200
echo $match->getStatusCode();
```##### Callback's
```php
callback('initCallback', function(array $routes) {// Your code here ...
});
// Match route
$instance->callback('matchCallback', function(array $routes, string $method, string $route, array $entity, IEntity $routeEntity) {// Your code here ...
});
// Route not found
$instance->callback('notFoundCallback', function(array $routes, string $method, string $route, array $entity = [], IEntity $routeEntity = null) {// Your code here ...
});
```##### [FcPhp\Route\Entity](https://github.com/00F100/fcphp-route/blob/master/src/Interfaces/IEntity.php)
```php