承接 appkita/ci4restfull-starter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

appkita/ci4restfull-starter

Composer 安装命令:

composer create-project appkita/ci4restfull-starter

包简介

CodeIgniter4 starter Restfull API

README 文档

README


PHP Composer Discord GitHub issues GitHub license

CodeIgniter 4 Restfull API Application Starter

Codeigniter 4 Restfull is the creation of Restfull API with the codeigniter 4 framework. Use is very simple and easy to use. And support with 4 types of security authentication ex. JWT, Basic, Key, Token

You can manage api using database or File configuration

follow Setup Configuration!

Chat

Discord

Installation & updates

  • composer
composer create-project appkita/ci4restfull-starter
cd ci4restfull-starter
composer update

-manual

  1. Download latest release from https://github.com/gunantos/ci4restfull-starter/releases
  2. extract to public_html
  3. composer install

Setup

  • Copy env to .env and tailor for your app, specifically the baseURL, any database settings and Restfull setting.

or

  • Open Folder App/Config/Restfull and edit
   //you can set database of file
   public $cekfrom = 'file'

   //configuration user cek
  public $user_config = [
      'model' => 'UserModel', //model name or parameter if you using file
      'username_coloumn'=>'email',
      'password_coloumn'=>'password',
      'key_coloumn' => 'apikey',
      'path_coloumn'=>'path',
      'block_coloumn'=>'isblock',
      'whitelist_coloumn'=>'whitelist',
      'blacklist_coloumn'=>'blacklist'
    ];

    //if you using file $cekfrom
    $UserModel = [
   	[
        'email'=>'user@email.com',
        'password'=>'password',
        'apikey'=>'123123',
        'isblock'=>false,  //if you block return true
        'whitelist'=>[], //add whitelist ip address
        'blacklist'=>[], //add blacklist ip address
        'path'=>'*' //use * for allow all access or array controllername_methodname
      ]
     ]

    //Configuration your Header API KEY
    public $haderKey = 'X-API-KEY';

    /**
     * @var array $allowed_key_parameter
     * if you API KEY allowed get from parameter GET, POST, or JSON
     */
    public $allowed_key_parameter = ['get', 'post', 'json'];
    //configuration data include on json token
   $token_data = 'username';

   public $allowed_format = ['json', 'xml', 'csv'];

    /**
     * @var string $default_format
     */
    public $default_format = 'json';
  • Create new Controller extends RestfullApi
  <?php

namespace App\Controllers;
use \Appkita\CI4Restfull\RestfullApi;
use \App\Models\UserModel;

class Home extends RestfullApi
{
	#protected $modelName = 'UserModel';
	protected $model;
    protected $allowed_format = ['json'];

	protected $auth = ['key'];

	function __construct() {
		$this->model = new UserModel();
	}
	public function index()
	{
		return $this->respond(['status'=>true, 'data'=>$this->model->findAll()]);
	}

	public function show($id = null)
	{
		return $this->respond(['status'=>true, 'data'=>$this->model->find($id)]);
	}

	public function create() {
		die('create ');
	}

	public function update($id = null) {
		die('update '. $id);
	}

	public function deleted($id = null) {
		die('deleted '. $id);
	}
}
  • Run application with spark or host
  //spark
  php spark serve
  • acess api http://localhost:8080 spark run http://localhost/yourapi/public xamp or wamp

Important

Please read the user guide of Codeigniter 4

Sponsor

Pay Coffe

appkita/ci4restfull-starter 适用场景与选型建议

appkita/ci4restfull-starter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 98 次下载、GitHub Stars 达 18, 最近一次更新时间为 2021 年 05 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 appkita/ci4restfull-starter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 appkita/ci4restfull-starter 我们能提供哪些服务?
定制开发 / 二次开发

基于 appkita/ci4restfull-starter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 18
  • Watchers: 1
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-10