veasin / nx-router-annotation
router annotation for nx
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:framework
Requires
- php: >=8.1
- veasin/nx: >=1.3.0
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){} }