nirvana72 / phprest2
There is no license information available for the latest version (1.1.0) of this package.
PhpRest2 是一款纯restful的轻量框架
1.1.0
2023-05-21 05:45 UTC
Requires
- php: >=8.2
- catfan/medoo: ^2.1
- monolog/monolog: ^3.3
- nikic/fast-route: ^1.3
- php-di/php-di: ^7.0
- symfony/cache: ^6.2
- symfony/http-foundation: ^6.2
- vlucas/valitron: ^1.4
README
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
其它 Other
需要php安装 apcu 扩展
QQ: 15279663