PHP code example of iblues / atu

1. Go to this page and download the library: Download iblues/atu library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

iblues / atu example snippets


    //请确保use以下
    use Iblues\AnnotationTestUnit\Annotation as ATU;

    //请确认有匹配的路由, 程序是根据路由的映射表进行查找. 如果路由映射错误, 会无法执行. 后期会处理这种问题
    /**
     * @ATU\Api(
     *     @ATU\Now(),
     * )
     */
    public function index(Request $request){//...}

    /**
     * 请确保 xx/xx/1有数据
     * @ATU\Api(
     *     "path":1,
     *      @ATU\Now(),
     * )
     */
    public function show(Request $request){//...}

   /**
     * @ATU\Api(
     *     @ATU\Now(),
     *     @ATU\Request({"title":122}),
     *     @ATU\Response({
     *      "data":{"id":true,"title":122}
     *     })
     * )
     */
    public function store($id,Request $request){//...}
shell script
php artisan vendor:publish --tag ATU