Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcard Route for Wildcard Actions #1

Open
nusphere opened this issue Jan 11, 2024 · 0 comments
Open

Wildcard Route for Wildcard Actions #1

nusphere opened this issue Jan 11, 2024 · 0 comments
Assignees

Comments

@nusphere
Copy link
Owner

Feature Request

In Laminas it is possible to set the action route variable, which acts as a "catch-all" route for the method in the controller.

Q A
New Feature yes

Summary

The following controller is given:

<?php 

namespace Module\Controller; 

use Laminas\Mvc\Controller\AbstractActionController;
use Symfony\Component\Routing\Attribute\Route;

#[Route('/api/{action}', name: 'my_wildcard_route')] 
class MyController extends AbstractActionController 
{
    public function myAction() { 
        //Your action code goes here...
    }

    public function userListAction() { 
        //Your action code goes here...
    }
}
  • a route call /api/my should call MyController::myAction
  • following route calls should call MyController::myAction:
    • /api/userList
    • /api/userlist
    • /api/user-list
    • /api/user_list
@nusphere nusphere self-assigned this Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant