PHP Classes

File: demos/config/routes.php

Recommend this page to a friend!
  Classes of Francesco Danti   ATK4 FastRoute   demos/config/routes.php   Download  
File: demos/config/routes.php
Role: Auxiliary script
Content typex: text/plain
Description: Auxiliary script
Class: ATK4 FastRoute
Process HTTP requests using configured routes
Author: By
Last change: Add support for php >= 7.4 < 8.2, Refactor Tests
Apply fixes from StyleCI

[ci skip] [skip ci]
Apply fixes from StyleCI

[ci skip] [skip ci]
refactor and align to atk4 2.2.0
Merge branch 'master' of https://github.com/abbadon1334/atk4-fastroute
code-fix test 3
add test for before after functionality
Apply fixes from StyleCI
refactor After and Before for any Route + from config
Date: 3 months ago
Size: 1,750 bytes
 

Contents

Class file image Download
<?php

declare(strict_types=1);

namespace
Abbadon1334\ATKFastRoute\Demos;

use
Abbadon1334\ATKFastRoute\Handler\RoutedServeStatic;

return [
    [
       
'/test',
        [
'GET', 'POST'],
        [
StandardClass::class, 'handleRequest'],
    ],
    [
       
'/',
        [
'GET', 'POST'],
        [
StandardClass::class, 'handleRequest'],
    ],
    [
       
'/testStatic',
        [
'GET', 'POST'],
        [
StandardClass::class, 'staticHandleRequest'],
    ],
    [
       
'/test2',
        [
'GET', 'POST'],
        [
ATKView::class, ['text' => 'it works']],
    ],
    [
       
'/callable',
        [
'GET', 'POST'],
        [
'\\Abbadon1334\\ATKFastRoute\\Demos\\handleWithFunction'],
        function (
$app, ...$parameters): void {
            echo
'BEFORE';
        },
        function (
$app, ...$parameters): void {
            echo
'AFTER';
        },
    ],
    [
       
'/test-parameters/{id:\d+}/{title}',
        [
'GET'],
        [
StandardClass::class, 'HandleRequest'],
    ],
    [
       
'/test-parameters-static/{id:\d+}/{title}',
        [
'GET'],
        [
StandardClass::class, 'staticHandleRequest'],
    ],
    [
       
'/resource/{path:.+}',
        [
'GET'],
        [
           
RoutedServeStatic::class,
            [
               
getcwd() . '/demo/static_assets',
                [
                   
'css',
                   
'js',
                ],
            ],
        ],
    ],
    [
       
'/test_before_after',
        [
'GET'],
        [
            function ():
void {
                echo
'content';
            },
        ],
        function (
$app, ...$parameters): void {
            echo
'BEFORE';
        },
        function (
$app, ...$parameters): void {
            echo
'AFTER';
        },
    ],
];