Tonic : 開發RESTful風格Web應用的PHP微型框架
Toni是一個開源PHP微型框架,用于開發RESTful風格Web應用。
特性:
- URI 注釋
- 資源與URL的映射會是通過一個@uri注釋實現
- Content negotiation
- Content and language negotiation support allowing you to easily pick the best representation for the client request.
- Method conditions
- Custom conditions can be added to methods via annotations allowing for conditional routing behaviour to be easily encapsulated.
- Mount points
- Mount namespaces of resources into any URL-space to make them portable.
01 <?php 02 03 /** 04 * @uri /hello 05 * @uri /hello/:name 06 */ 07 class Hello extends Tonic\Resource { 08 09 /** 10 * @method GET 11 * @provides text/html 12 */ 13 function sayHello($name = 'World') { 14 return 'Hello '.$name; 15 } 16 }
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!