Skip to content

PhpRest2 是一款纯restful的轻量框架, 基于php8 及以上版本

License

Notifications You must be signed in to change notification settings

nirvana72/phpRest2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

介绍 Introduction

PhpRest2 是一款纯restful的轻量框架, 基于php8及以上版本

<?php
namespace App\Controller;

use PhpRest2\Controller\Attribute\{Controller, Action};

#[Controller('/index')]
class IndexController
{
    #[Action('GET:/index')]
    public function index($p1) 
    {
        return "p1 = {$p1}";
    }
}

使用示列 Example

环境 Requirements

  • PHP >= 8.0

安装 Installation

composer require nirvana72/phpRest2

nginx 配置

server {
    ...

    location / {
        try_files $uri /index.php$is_args$args;
    }

    ...
}

apache 配置

开启 mod_rewrite 模块,入口目录(/public) 下添加 .htaccess 文件:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

文档 Document

参数绑定

参数绑定实体类

中间件hook

数据库操作

ORM

文件上传

事件驱动

路由信息

其它 Other

需要php安装 apcu 扩展

QQ: 15279663

About

PhpRest2 是一款纯restful的轻量框架, 基于php8 及以上版本

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages