<commit_before>Simple router for PHP
=================


Features
-------------------

 * Filters
 * Support REST
 * Groups
 * Caching rules
 * Standalone module/component for [Rock Framework](https://github.com/romeOz/rock)

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

 * [Installation](#installation)
 * [Quick Start](#quick-start)
 * [Pattern](#pattern)
 * [Configurable](#as-configurable)
 * [Filters](#filters) 
 * [REST](#rest)
 * [Using groups](#using-groups)
    - [Route prefixing](#route-prefixing)
    - [Sub-Domain routing](#sub-domain-routing)
 * [Alias for route](#alias-for-route)
 * [Using response](#using-response)
 * [Caching rules](#caching-rules)
 * [Requirements](#requirements)
 
Quick Start
-------------------

```php
// url: http://site.com/items/7/        

$route = new Route();
 
$handler = function(Route $route){
    return 'id: ' . $route->getParam('id');
};
       
$route->get('/items/{id:\d+}/', $handler, ['as' => 'item']);
$route->post('/items/', ['\namespace\SomeController', 'actionCreate']);
$route->run();

// output: 'id: 7'

echo Alias::getAlias('@item', ['id' => 15]); // output: '/items/15/'<commit_msg>Minor adjustments to README.<commit_after>Simple router for PHP
=================


Features
-------------------

 * Filters
 * Support REST
 * Groups
 * Caching rules
 * Standalone module/component for [Rock Framework](https://github.com/romeOz/rock)

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

 * [Installation](#installation)
 * [Quick Start](#quick-start)
 * [Pattern](#pattern)
 * [Configurable](#configurable)
 * [Filters](#filters) 
    - [Custom filter](#custom-filter)
 * [REST](#rest)
 * [Using groups](#using-groups)
    - [Route prefixing](#route-prefixing)
    - [Sub-Domain routing](#sub-domain-routing)
 * [Alias for route](#alias-for-route)
 * [Using response](#using-response)
 * [Caching rules](#caching-rules)
 * [Requirements](#requirements)

Installation
-------------------

From the Command Line:

```
composer require romeoz/rock-route
```

or in your composer.json:

```json
{
    "require": {
        "romeoz/rock-route": "*"
    }
}
``` 
 
Quick Start
-------------------

```php
// url: http://site.com/items/7/        

$route = new Route();
 
$handler = function(Route $route){
    return 'id: ' . $route->getParam('id');
};
       
$route->get('/items/{id:\d+}/', $handler, ['as' => 'item']);
$route->post('/items/', ['\namespace\SomeController', 'actionCreate']);
$route->run();

// output: 'id: 7'

echo Alias::getAlias('@item', ['id' => 15]); // output: '/items/15/'
{'fraction_non_alphanumeric': 0.2607325718786924, 'fraction_numerical': 0.004726270185112249, 'mean_word_length': 3.1571194762684125, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3413346', 'n_tokens_mistral': 853, 'n_tokens_neox': 783, 'n_words': 161}