PHP Classes

PHP Router Library JS: Get HTTP request route based on a hash parameter

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 97 All time: 9,805 This week: 103Up
Version License PHP version Categories
routejs 1.0.0MIT/X Consortium ...5HTTP, PHP 5
Description 

Author

This package can get an HTTP request route based on a hash parameter.

It checks a hash parameter value sent via HTTP post and parses and YAML file with route configuration to extract the route definitions associated with the hash value.

The package returns a JSON structure with the definition of the hash routes.

Innovation Award
PHP Programming Innovation award nominee
February 2022
Number 10
Many Web applications can process browser-side requests using JavaScript using responses retrieved from the server-side. PHP code can handle those server-side requests.

This package can process client-side requests to retrieve HTTP route information from the server-side according to a parameter that is the value after the hash (#) character.

This possibility allows configuring Web application routes for applications implemented on the client-side in JavaScript using PHP code's configuration values defined on the server-side.

Manuel Lemos
Picture of Sergey Kol'miller
  Performance   Level  
Name: Sergey Kol'miller <contact>
Classes: 5 packages by
Country: Russian Federation Russian Federation
Age: 40
All time rank: 354498 in Russian Federation Russian Federation
Week rank: 368 Up14 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 3x

Documentation

PHP and JavaScript route for hash module.

"require": {

    "symfony/yaml": "^4.0"
}  

"dependencies": {

"ajaxsim": "^1.0.0"

}

_Installation_

php: $~ composer require kolserdav/routejs

js: $~ npm i route-fhash

_Route settings_

file name: /config/route/routes.yaml

#Example routes.yaml
nameroutegroup1 :	#Require field custom name
      hash: #Require field and name
        nameroute1 : filename1::module1 #Custom fields with special format
        nameroure2 : filename2::module2
nameroutegroup2 :
      hash :
        nameroute3 : filename3::module3
        nameroute4 : filename4::module4
        nameroute4 : filename4::module5

_Using php_

script uri: /routejs-data

require_once '../vendor/autoload.php';
use Avir\Hash\Reader;
$s = new Reader();
$s->getRoutes();

_Using javascript_

let route = require('route-fhash');
route('dir/with/route/files');

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file, 1 directory)
Plain text file composer.json Data Auxiliary data
Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageMain (1 file)
  Plain text file Reader.php Class Class source

  Files folder image Files  /  src  /  Main  
File Role Description
  Plain text file Factory.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:97
This week:0
All time:9,805
This week:103Up