wdlndfx / artemis
描述
dev-master
2023-07-04 19:21 UTC
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: 10
This package is auto-updated.
Last update: 2024-09-04 21:40:37 UTC
README
Artemis->php
一个类似于Express.js的php路由器
目录
特性
- 路由:Artemis 提供了一个简单直观的路由机制。它允许你根据 HTTP 方法以及 URL 模式定义路由,使得处理不同的端点和 HTTP 操作变得容易。
- 中间件:Artemis 使用中间件函数来处理请求/响应处理的各个方面。中间件函数可以用于日志记录、身份验证、错误处理、解析请求体等任务。Express 提供了一个丰富的内置中间件生态系统,以及创建自定义中间件的能力。
- 可扩展性:Artemis 具有高度的可扩展性,允许你通过第三方中间件和库添加额外的功能
安装
mkdir example
cd example
touch index.php
composer require wdlndfx/artemis:dev-master
使用
快速开始
在 index.php 中 ->
<?php require_once __DIR__.'/vendor/autoload.php'; use Artemis\Core\Router\Router; $app = Router::getInstance(); $app->get("/", function($req,$res){ $res->send("<h1>Hello World!</h1>"); $res->status(200); }); $app->listen("/", function(){ });
在终端中启动本地服务器
php -S localocalhost:8000
许可证
MIT 许可证
版权所有 (c) 2023 leonn00albert