\PhpApi\AnnotationsHttpMethod

The annotation to specify a HTTP request method that triggers a class method.

Summary

Methods
Properties
Constants
No public methods found
$name
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$name

$name : string

The HTTP request method should be:

  • GET
  • POST
  • PUT
  • DELETE
  • OPTIONS
  • HEAD
  • TRACE
  • CONNECT

Add more HTTP request methods to the same class method by using commas. If a class method has no @Method, then any HTTP request method will execute that class method.

*@Api("my/route") // put this in javadoc style
// No @HttpMethod annotation, accepts all HTTP request methods
public function myRoute() {
 // code
}
*@Api("route/with/$var") // put this in javadoc style
*@HttpMethod("PUT") // accepts only PUT requests
public function routeWith($var) {
 // code
}
*@Api("another/$id/maybe/$var") // put this in javadoc style
*@HttpMethod("GET,POST") // accepts only GET and POST requests
public function routeAnother($id, $var) {
 // code
}

Type

string