wyrihaximus / react-http-middleware-webroot-preload
react/http 中间件静态 webroot 服务
2.3.1
2023-01-14 19:58 UTC
Requires
- php: ^7.4 || ^8.0
- ancarda/psr7-string-stream: ^1.3
- league/mime-type-detection: ^1.9
- psr/http-message: ^1
- psr/log: ^3 || ^2 || ^1.1
- react/cache: ^1
- react/http: ^1
- react/promise: ^2.8
- scriptfusion/byte-formatter: ^3.2 || ^4.0
- thecodingmachine/safe: ^2 || ^1.3
- wyrihaximus/constants: ^1.5
Requires (Dev)
- brunty/cigar: ^1.12
- wyrihaximus/async-test-utilities: ^4.2
- dev-master
- 304.x-dev
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.0
- dev-renovate/configure
- dev-dependabot/composer/composer/composer-1.10.27
- dev-dependabot/composer/guzzlehttp/psr7-2.5.0
- dev-dependabot/composer/psr/http-message-1.1
- dev-replace-mime-detector-with-one-that-supports-php-8
- dev-add-missing-thecodingmachine-safe
- dev-etag
- dev-use-react-cache-instead-of-an-array
- dev-imgbot
- dev-smoke
This package is auto-updated.
Last update: 2024-09-05 09:49:26 UTC
README
安装
通过 Composer 安装,使用以下命令,它将自动检测最新版本并将其绑定到 ^
。
composer require wyrihaximus/react-http-middleware-webroot-preload
用法
中间件接受两个参数,首先是 webroot 目录,其次是可选的 PSR-3 日志记录器。需要注意的是,webroot 中的所有文件都将被提供服务,无论文件类型如何。所以不应该包含 PHP 或包含密码等的文件。
$webroot = '/var/www/'; $logger = new Psr3Logger(); // Require, PSR-3 logger for bootstrap logging $cache = new ArrayCache(); // Required, custom cache configuration $server = new Server([ /** Other middleware */ new WebrootPreloadMiddleware($webroot, $logger, $cache), /** Other middleware */ ]);
许可证
MIT 许可证 (MIT)
版权所有 (c) 2017 Cees-Jan Kiewiet
特此免费授予任何获得本软件及其相关文档副本(“软件”)的人权,自由使用软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本,并允许向获得软件的人提供软件,前提是遵守以下条件
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、针对特定目的的适用性和非侵权性。在任何情况下,作者或版权持有人均不对任何索赔、损害或其他责任承担责任,无论源于合同、侵权或其他方式,源于、源自或与软件或软件的使用或其他交易有关。