Download the PHP package yilu-tech/micro-api without Composer

On this page you can find all versions of the php package yilu-tech/micro-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package micro-api

使用方法1

    <?php

    namespace Center\Controllers;
    use YiluTech\MicroApi\MicroApi;
    class BrandController extends Controller
    {
        function list(MicroApi $microApi){
            $microApi->get('store/store/create',[]);;
        }
    }

使用方法2

    \MicroApi::get('store/create')->query([])->run();

异常

    public function testGet(){

        try{
            $res = \MicroApi::get('/center/brand/list')->run();
            dump($res->data());  //获取数据
        }catch (MicroApiRequestException $e){
            var_dump($e->getMessage()); //错误描述
            var_dump($e->data());    //错误内容
        }

        $this->assertTrue(true);
    } 

如果,没有复杂的事物问题,try-catch可以交给框架去做

参数说明

    \MicroApi::get($uri)->run();
    \MicroApi::post($uri)->json([])->run();
    \MicroApi::put($uri)->run();
    \MicroApi::patch($uri)->run();
    \MicroApi::delete($uri)->run();

    $uri 
    1. center/brand/list     center作为模块名在config/micro.php中配置基础地址
    2. http://baidu.com      直接请求这个地址. 

返回

    成功:
    {status:1,data:{}}

    MicroApiResponse
        MicroApiResponse->getJson()
        MicroApiResponse->getContents()      

    失败: 

    MicroApiRequestException
        MicroApiRequestException->data()   
        MicroApiRequestException->getMessage()
        MicroApiRequestException->getMessage()

All versions of micro-api with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
guzzlehttp/guzzle Version ^6.2@dev
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yilu-tech/micro-api contains the following files

Loading the files please wait ....