A Restful PHP Microservice Framework!

Overview

SLIM 4 FRAMEWORK

Build Status Coverage Status PHP Version Require License

Introduction

This project was built with php SLIM 4 framework with ADR mode, whcich is a compatible resolution of RESTful Api.

Features

Minimal requirements

  • docker/docker-compose
  • php: >=8.0
  • composer

Installation

Run this command from the directory in which you want to install your new Slim application. You will require PHP 8.0 or newer.

composer create-project poabob/slim-4-framework [my-app]

Config

  • Write your Db schema

init.sql

CREATE DATABASE IF NOT EXISTS Example;
USE Example;
CREATE TABLE IF NOT EXISTS `Example`.`Users` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `name` VARCHAR(64) NOT NULL, `password` VARCHAR(64) NOT NULL ,  PRIMARY KEY (`id`)) ENGINE = InnoDB;
  • DB config

If you use sqlite for your database, juse commit mysql config.

docker-compose.yml

  mysql:
    ...
    environment:
      - MYSQL_DATABASE={DB}
      - MYSQL_ROOT_PASSWORD={root_password}
      - MYSQL_USER={user}
      - MYSQL_PASSWORD={user_password}
  • Generate Secret Key for Jwt
# Generate PRIVATE KEY
openssl genrsa -out private.pem 2048
# Generate PUBLIC KEY
openssl rsa -in private.pem -outform PEM -pubout -out public.pem
  • .env configuration

If you use sqlite for your database, just commit mysql config.

# dev/prod/stage/test
MODE=dev
# MYSQL CONFIG
DB_DRIVER=mysql
DB_NAME={DB}
DB_HOST=mysql
DB_USER={user}
DB_PASS={user_password}
DB_CHARSET=utf8mb4

# SQLITE CONFIG
# DB_DRIVER=sqlite
# DB_NAME={./path/Example.db}

# SETTINGS FOR DEBUG (0/1)
# please don't display error details in production environment.
DISPLAY_ERROR_DETAILS=1
LOG_ERROR_DETAILS=1
LOG_ERRORS=1


# JWT SETTINGS
JWT_ISSUER=SLIM_4
JWT_LIFETIME=86400
JWT_PRIVATE_KEY="{PRIVATE KEY}"
JWT_PUBLIC_KEY="{PUBLIC KEY}"

Run

dev

composer install
composer run start

prod

composer install --no-dev --optimize-autoloader
composer run start

test

<!-- Before you test, please check out your vendor which was instlled. -->
composer run test
You might also like...
I made my own simple php framework inspired from laravel framework.

Simple MVC About Since 2019, I started learning the php programming language and have worked on many projects using the php framework. Laravel is one

Framework X is a simple and fast micro framework based on PHP
Framework X is a simple and fast micro framework based on PHP

Framework X is a simple and fast micro framework based on PHP. I've created a simple CRUD application to understand how it works. I used twig and I created a custom middleware to handle PUT, DELETE methods.

Spiral Framework is a High-Performance PHP/Go Full-Stack framework and group of over sixty PSR-compatible components
Spiral Framework is a High-Performance PHP/Go Full-Stack framework and group of over sixty PSR-compatible components

Spiral HTTP Application Skeleton Spiral Framework is a High-Performance PHP/Go Full-Stack framework and group of over sixty PSR-compatible components.

Sunhill Framework is a simple, fast, and powerful PHP App Development Framework

Sunhill Framework is a simple, fast, and powerful PHP App Development Framework that enables you to develop more modern applications by using MVC (Model - View - Controller) pattern.

Framework X – the simple and fast micro framework for building reactive web applications that run anywhere.

Framework X Framework X – the simple and fast micro framework for building reactive web applications that run anywhere. Quickstart Documentation Tests

FuelPHP v1.x is a simple, flexible, community driven PHP 5.3+ framework, based on the best ideas of other frameworks, with a fresh start! FuelPHP is fully PHP 7 compatible.

FuelPHP Version: 1.8.2 Website Release Documentation Release API browser Development branch Documentation Development branch API browser Support Forum

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols. PHP>=5.3.
An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols. PHP=5.3.

Workerman What is it Workerman is an asynchronous event-driven PHP framework with high performance to build fast and scalable network applications. Wo

Fast php framework written in c, built in php extension

Yaf - Yet Another Framework PHP framework written in c and built as a PHP extension. Requirement PHP 7.0+ (master branch)) PHP 5.2+ (php5 branch) Inst

💫 Vega is a CLI mode HTTP web framework written in PHP support Swoole, WorkerMan / Vega 是一个用 PHP 编写的 CLI 模式 HTTP 网络框架,支持 Swoole、WorkerMan

Mix Vega 中文 | English Vega is a CLI mode HTTP web framework written in PHP support Swoole, WorkerMan Vega 是一个用 PHP 编写的 CLI 模式 HTTP 网络框架,支持 Swoole、Work

Releases(0.1.1)
Owner
POABOB
a person
POABOB
🚀 PHP Microservice Full Coroutine Framework

PHP microservice coroutine framework 中文说明 Introduction Swoft is a PHP microservices coroutine framework based on the Swoole extension. Like Go, Swoft

Swoft Cloud 5.5k Dec 28, 2022
Jin microservices is a complete microservice demo based on PHP language + hyperf microservices framework

介绍 Jin-microservices是基于 php 语言 + hyperf 微服务 框架的完整微服务demo。 github:https://github.com/Double-Jin/jin-microservices gitee:https://gitee.com/ljj96/jin-mic

null 114 Dec 29, 2022
DoraRPC is an RPC For the PHP MicroService by The Swoole

Dora RPC 简介(Introduction) Dora RPC 是一款基础于Swoole定长包头通讯协议的最精简的RPC, 用于复杂项目前后端分离,分离后项目都通过API工作可更好的跟踪、升级、维护及管理。 问题提交: Issue For complex projects separation

Chang Long Xu 468 Jan 5, 2023
Files Course Laravel Microservice E-mail

Curso Laravel Microservices com RabbitMQ (micro e-mail) Saiba Mais Sobre o Curso Requisitos Este micro e-mail depende do microservice 01, portanto, pr

EspecializaTi 9 Oct 21, 2021
🔭 Proof of concept on adding observability features (tracing and metrics) to a Nano microservice (using existing Hyperf components).

?? Tracing Nano Proof of concept on adding observability features (tracing and metrics) to a Nano microservice (using existing Hyperf components ?? ).

Leo Cavalcante 4 Oct 24, 2022
PhpBoot is an easy and powerful PHP framework for building RESTful/Microservices APIs.

?? tiny & fast PHP framework for building Microservices/RESTful APIs, with useful features: IOC, Hook, ORM, RPC, Swagger, Annotation, Parameters binding, Validation, etc.

tknet 656 Jan 4, 2023
Volistx Framework For RESTful API Based on Laravel/Lumen 9.x

Volistx Framework Volistx Framework For RESTful API Based on Laravel/Lumen 9.x This is a framework skeleton for Volistx API platform using Lumen PHP F

Volistx Solutions 2 Nov 18, 2022
CleverStyle Framework is simple, scalable, fast and secure full-stack PHP framework

CleverStyle Framework is simple, scalable, fast and secure full-stack PHP framework. It is free, Open Source and is distributed under Free Public Lice

Nazar Mokrynskyi 150 Apr 12, 2022
I made my own simple php framework inspired from laravel framework.

Simple MVC About Since 2019, I started learning the php programming language and have worked on many projects using the php framework. Laravel is one

null 14 Aug 14, 2022
PHPR or PHP Array Framework is a framework highly dependent to an array structure.

this is new repository for php-framework Introduction PHPR or PHP Array Framework is a framework highly dependent to an array structure. PHPR Framewor

Agung Zon Blade 2 Feb 12, 2022