定制 emir/kapi 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

emir/kapi

Composer 安装命令:

composer create-project emir/kapi

包简介

Slim Framework based API skeleton application for rapid development

README 文档

README

Build Status

Slim Framework based simple helper to generate RESTful API's and applications, requires PHP 7.

KAPI means "door" in Turkish.

Creating a Project skeleton

git clone https://github.com/emir/kapi myproject
cd myproject
composer install

It will create an example project.

Edit Configuration

$EDITOR .env

Migrations

phinx migrate

Running the Project

cd myproject
php -S localhost:8080 -t public

That's all! :)

Getting Started

You should define your URLs in routes.php:

# src/routes.php
<?php

$urls = [
  ['get', '/books', 'BooksController::index', 'List all books.']
];

Create your models:

# src/Models/Book.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Book extends Model
{
    /**
     * @var array
     */
    protected $guarded = [];
}

Create your Controllers and methods:

# src/Controllers/BooksController.php
<?php

namespace App\Controllers;

use App\Models\Book;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\QueryException;
use Slim\Http\Request;
use Slim\Http\Response;

class BooksController extends AbstractController
{
    /**
     * @param Request $request
     * @param Response $response
     * @return Response
     */
    public function index(Request $request, Response $response): Response
    {
        $books = Book::all();
        
        return $response->withJson($books);
    }
}

Done!

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 181
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 181
  • Watchers: 14
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固