PHP Classes

File: demos/static.php

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

[ci skip] [skip ci]
Merge branch 'align-with-atk4-2.3.5' of https://github.com/abbadon1334/atk4-fastroute

 Conflicts:
 src/Route/Route.php
 src/Router.php
Clean up
code-fix test 3
refactor and align to atk4 2.2.0
Date: 3 months ago
Size: 604 bytes
 

Contents

Class file image Download
<?php

declare(strict_types=1);

namespace
Abbadon1334\ATKFastRoute\Demos;

date_default_timezone_set('UTC');

require_once
__DIR__ . '/../vendor/autoload.php';

/** @var \Atk4\Ui\App $app */
require __DIR__ . '/init-app.php';

use
Abbadon1334\ATKFastRoute\Handler\RoutedServeStatic;
use
Abbadon1334\ATKFastRoute\Router;

$router = new Router($app);
// $router->setBaseDir('/'); // added only for coverage in unit test
$router->addRoute(
   
'/assets/{path:.+}',
    [
'GET'],
    new
RoutedServeStatic(
       
__DIR__ . '/static_assets',
        [
           
'css',
        ]
    )
);

$router->run();