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 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!