PHP Classes
elePHPant
Icontem

ATK4 FastRoute: Process HTTP requests using configured routes

Recommend this page to a friend!
  Info   View files Example   View files View files (40)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-07-20 (11 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: 14 This week: 14All time: 9,635 This week: 21Up
Version License PHP version Categories
atk4-fastroute 1.0MIT/X Consortium ...7HTTP, Design Patterns, PHP 7, Traits
Collaborate with this project Author

atk4-fastroute - github.com

Description

This package can process HTTP requests using configured routes.

It can configure one or more routes by specifying a URL pattern to match, HTTP methods, and code that should be called when the current HTTP request matches that route.

The package can also process the current HTTP request and call the code associated to the route that matches the current request URL.

  Performance   Level  
Name: Francesco Danti <contact>
Classes: 3 packages by
Country: Italy Italy

 

Details

atk4-fastroute

Build Status Codacy Badge Coverage Status Test Coverage Maintainability

ATK4 integration with FastRoute

Still needs :

  • [x] more test for patterns route
  • [x] test for calls with extraparameters
  • [ ] check if can be simplified
  • [ ] add Translation as option - [ ] add slugging of routes
  • [ ] check if can be added MiddlewareInterface - [ ] to be executed by pattern (Another Router in Router that dispatch MW by route match) ? - [ ] to be executed per route (before handlingRoute)?
  • [ ] add comments to public methods!!!
  • [ ] add documentation

EXPERIMENTAL

Define routes : - RoutedCallable : as Callable - RoutedUI : as atk4/ui/* Class to be added to the App - RoutedMethod : as Class Method to be called like a controller

Routes can be serialized as array to allow loading from external file.

Using Interface implementation to define behaviour and needs of the class ( like flags ) :

- iBeforeRoutable : request method OnBeforeRoute which will be called right before OnRoute ( setting up app? ) - iAfterRoutable : request method OnAfterRoute which will be called right after OnRoute ( setup other elements? ) - iArrayable : have fromArray and toArray to be serializeable - iNeedAppRun : if is needed to call ->app->run() after Routing method calls

Next step

  • Having a collection of routes, that in the future can be translatable
  Files folder image Files  
File Role Description
Files folder imagedemos (6 files, 2 directories)
Files folder imagesrc (1 file, 4 directories)
Files folder imagetests (1 file)
Accessible without login Plain text file .codeclimate.yml Data Auxiliary data
Accessible without login Plain text file .coveralls.yml Data Auxiliary data
Accessible without login Plain text file .phpmetrics.json Data Auxiliary data
Accessible without login Plain text file .php_cs.dist Example Example script
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file renovate.json Data Auxiliary data

  Files folder image Files  /  demos  
File Role Description
Files folder imageconfig (1 file)
Files folder imagestatic_assets (1 file)
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Plain text file bootstrap.php Class Class source
  Plain text file cached.php Class Class source
  Plain text file index.php Class Class source
  Accessible without login Plain text file static.php Example Example script
  Accessible without login Plain text file using-config.php Example Example script

  Files folder image Files  /  demos  /  config  
File Role Description
  Accessible without login Plain text file routes.php Aux. Auxiliary script

  Files folder image Files  /  demos  /  static_assets  
File Role Description
  Accessible without login Plain text file test.css Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageException (3 files)
Files folder imageHandler (4 files, 1 directory)
Files folder imageRoute (2 files)
Files folder imageView (3 files)
  Plain text file Router.php Class Class source

  Files folder image Files  /  src  /  Exception  
File Role Description
  Plain text file StaticFileExtensionNotAllowed.php Class Class source
  Plain text file StaticFileNotAllowedFolder.php Class Class source
  Plain text file StaticFileNotExists.php Class Class source

  Files folder image Files  /  src  /  Handler  
File Role Description
Files folder imageContracts (7 files)
  Plain text file RoutedCallable.php Class Class source
  Plain text file RoutedMethod.php Class Class source
  Plain text file RoutedServeStatic.php Class Class source
  Plain text file RoutedUI.php Class Class source

  Files folder image Files  /  src  /  Handler  /  Contracts  
File Role Description
  Plain text file AfterRoutableTrait.php Class Class source
  Plain text file BeforeRoutableTrait.php Class Class source
  Plain text file iAfterRoutable.php Class Class source
  Plain text file iArrayable.php Class Class source
  Plain text file iBeforeRoutable.php Class Class source
  Plain text file iNeedAppRun.php Class Class source
  Plain text file iOnRoute.php Class Class source

  Files folder image Files  /  src  /  Route  
File Role Description
  Plain text file iRoute.php Class Class source
  Plain text file Route.php Class Class source

  Files folder image Files  /  src  /  View  
File Role Description
  Plain text file AbstractView.php Class Class source
  Plain text file MethodNotAllowed.php Class Class source
  Plain text file NotFound.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file RouterTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:14
This week:14
All time:9,635
This week:21Up