veasin/nx-router-annotation

There is no license information available for the latest version (0.0.3) of this package.

router annotation for nx

0.0.3 2024-11-16 10:51 UTC

This package is auto-updated.

Last update: 2024-11-16 10:54:14 UTC


README

router annotation for nx

composer require urn2/nx-router-annotation

to build "./src/route.php":

composer.json

{
	"scripts":{
		"routeMake":"nx\\tools\\routeAnnotation::Make",
		"route": "@routeMake --sort \\any\\controllers\\ --file /route.php -o"
	}
}

args

  • --file default:/route.php => ./src/route.php
  • --sort default: none \any\controllers\some => some
  • --origin, -o support nx\parts\router\uri

composer run-script route

php

in controller

#[Any("*", 'cors', 'error')]
#[
	Get("/user/d:uid", "get"),
	Post('/user', 'register'),
	Put("/user/d:uid", "put"),
	Patch("/user/d:uid", "patch"),
	Delete('/user/d:uid', 'delete')
]
#[REST("/console/user", "/d:uid", "list,add,get,update,delete")]
class some extends \nx\helpers\controller\model{
	#[Get("/user")]
	public function check():void{}
	#[Delete("/user/d:uid")]
	public function logout(){}
	#[Method("post", "/user", "add", "register")]
	public function register($next, $params){}
}