2017 © Pedro Peláez
 

project kapi

Slim Framework based API skeleton application for rapid development

image

emir/kapi

Slim Framework based API skeleton application for rapid development

  • Monday, April 23, 2018
  • by emir
  • Repository
  • 16 Watchers
  • 181 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

KAPI: Doors for PHP - v1.0.0

Build Status, (*1)

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

KAPI means "door" in Turkish., (*3)

Creating a Project skeleton

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

It will create an example project., (*4)

Edit Configuration

$EDITOR .env

Migrations

phinx migrate

Running the Project

cd myproject
php -S localhost:8080 -t public

That's all! :), (*5)

Getting Started

You should define your URLs in routes.php:, (*6)

# src/routes.php
<?php

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

Create your models:, (*7)

# 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:, (*8)

# 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)

The Versions

23/04 2018

dev-master

9999999-dev http://github.com/emir/kapi

Slim Framework based API skeleton application for rapid development

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest microframework

23/04 2018

1.0.0

1.0.0.0 http://github.com/emir/kapi

Slim Framework based API skeleton application for rapid development

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest microframework