PHP Classes

File: docs/files/Annotations/HttpMethod.php.txt

Recommend this page to a friend!
  Classes of Natanael Simões   PHP API Framework   docs/files/Annotations/HttpMethod.php.txt   Download  
File: docs/files/Annotations/HttpMethod.php.txt
Role: Documentation
Content type: text/plain
Description: Documentation
Class: PHP API Framework
Handle API requests with annotated classes
Author: By
Last change:
Date: 7 years ago
Size: 1,631 bytes
 

Contents

Class file image Download
<?php namespace PhpApi\Annotations; /** * The annotation to specify a HTTP request method that triggers a class method. * @Annotation * @Target("METHOD") * @package PhpApi * @copyright (c) 2017, Federal Institute of Rondonia * @license http://gnu.org/licenses/lgpl.txt LGPL-3.0+ * @author Natanael Simoes <natanael.simoes@ifro.edu.br> * @since Release 0.1.0 * @link https://github.com/ifroariquemes/PHP-API Github repository */ class HttpMethod { /** * The HTTP request method should be: * * <ul> * <li>GET</li> * <li>POST</li> * <li>PUT</li> * <li>DELETE</li> * <li>OPTIONS</li> * <li>HEAD</li> * <li>TRACE</li> * <li>CONNECT</li> * </ul> * * 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. * * <pre> * *@Api("my/route") // put this in javadoc style * // No @HttpMethod annotation, accepts all HTTP request methods * public function myRoute() { * // code * }</pre> * * <pre> * *@Api("route/with/$var") // put this in javadoc style * *@HttpMethod("PUT") // accepts only PUT requests * public function routeWith($var) { * // code * }</pre> * * <pre> * *@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 * }</pre> * @var string */ public $name; }