定制 charm/dispatcher 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

charm/dispatcher

Composer 安装命令:

composer require charm/dispatcher

包简介

Creates PSR-7 Server Server Requests for PSR-15 Server Request Handlers and Middlewares from a web server, ReactPHP, Swoole or the command line.

README 文档

README

Create an application that implements Psr\Http\Server\RequestHandlerInterface, and run it:

    <?php
    use Psr\Http\Server\RequestHandlerInterface;
    use function Charm\serve;

    class HelloWorldApp implements RequestHandlerInterface {

        /**
         * Responds with "Hello World from /whatever/path"
         */
        public function handle(ServerRequestInterface $request): ResponseInterface {
            return $this->createResponse(200)->withBody($this->createStream("Hello World from ".$request->getRequestTarget()));
        }

    }

    // Serve via HTTP or command line
    serve(new MyApp());

Now you can access your application via the web and from the command line:

    # php myapp.php
    Hello World from /

    # php myapp.php users 123
    Hello World from /users/123

    # php myapp.php users --email "you@example.com"
    Hello World from /users?email=you@example.com

    # curl https://myserver.php/users?email=you@example.com
    Hello World from /users?email=you@example.com

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固