Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8603549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:21:02+00:00 2026-06-12T02:21:02+00:00

How can I configure Zend Framework 2 route to only to allow POST request

  • 0

How can I configure Zend Framework 2 route to only to allow POST request type?

I’ve gone through the documentation but no avail.

EDIT

Here is the portion of my DI code

'cv-create' => array(
    'type' => 'Zend\Mvc\Router\Http\Segment',
    'options' => array(
        'route'    => '/profile/cv/:type/create',
        'defaults' => array(
            'controller' => 'Application\Controller\ProfileController',
            'action'     => 'cv_create',
        ),
    ),
),

My actual question is, is there any way to inject the request control as a constraint to this route?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:21:03+00:00Added an answer on June 12, 2026 at 2:21 am

    You could extend the Zend\Mvc\Router\Http\Segment class and create a slightly modified version of match(). Since match() has the $request parameter it should be as simple as follows:

    public function match(Request $request, $pathOffset = null)
    {
        if (!$request->isPost())
        {
            return null;    
        }
    
        return parent::match($request, $pathOffset);
    }
    

    Then use this modified class instead of the standard Segment in the routing configuration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I configure Netbeans to autocomplete code when I type the capital letters? E.g.
So I know that you can set a custom default action in Zend Framework
Using PHP 5.3 and Zend Framework 1.11.7 I've been trying to configure the AutoLoader
Why do I have to configure an include_path when installing Zend Framework instead of
I have a following route configure in routes.ini routes.frontnoncms.type = Zend_Controller_Router_Route_Regex routes.frontnoncms.route = /?([a-zA-Z0-9_-]+)?/?(newsletter|contactus|accessability|search)/?([a-zA-Z0-9_-]+)?/?([a-zA-Z0-9_-]+)?
I know I can configure command line arguments in the Run configuration but I
I've been trying to configure this for quite some time now but I can't
I know I can configure tt_news to automatically set author and email to a
The users of my app can configure the layout of certain files via a
I'd like to know how I can configure TortoiseHg Workbench so it alawys supplies

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.