PHP code example of onlyoung4u / as-api

1. Go to this page and download the library: Download onlyoung4u/as-api 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/ */

    

onlyoung4u / as-api example snippets


env('key', 'default')

// 增加
'admin' => \Onlyoung4u\AsApi\Kernel\Exception\Handler::class,
'AsApi' => \Onlyoung4u\AsApi\Kernel\Exception\Handler::class,

Route::fallback(function () {
    return json(['code' => 404, 'msg' => '404 not found', 'data' => (object)[]]);
});

Route::disableDefaultRoute();
shell
# 创建
php vendor/bin/phinx create MyNewMigration

# 全部迁移
php vendor/bin/phinx migrate
# 指定迁移目标版本
php vendor/bin/phinx migrate -t 20220101000001
shell
# 创建
php vendor/bin/phinx seed:create MyNewSeeder

# 全部填充
php vendor/bin/phinx seed:run
# 指定填充文件
php vendor/bin/phinx seed:run -s MyNewSeeder