jdwx/web
最新稳定版本:v3.0.2
Composer 安装命令:
composer require jdwx/web
包简介
README 文档
README
Basic library code for web applications in PHP.
Installation
You can require it directly with Composer:
composer require jdwx/web-php
Or download the source from GitHub: https://github.com/jdwx/web-php.git
Requirements
This module requires PHP 8.3 or later.
Usage
The most-used functionality of this module is providing a type-safe interface to the web-related superglobals. Here is a basic usage example:
$req = Request::getGlobal(); # Returns a Parameter or null if the parameter is not set. $param = $req->get( 'param' ); # Returns a Parameter or throws an exception if the parameter is not set. $param = $req->getEx( 'param' ); # Get a parameter as a string, exploding if either assumption (that it # exists and is a string) is false. (See jdwx_param for other types and # conversions available.) This is the most common idiom for getting # parameters from the request safely. $param = $req->postEx( 'param' )->asString(); # Get the contents of a file upload without moving it to a permanent location. $param = $req->FILES()->fetchAsString( 'file_param' );
There are many unit tests for this module that provide additional examples of usage.
Stability
This bulk of this module (include functionality related to requests, sessions, server values, and files) is considered stable and is extensively used in production code, handling millions of requests per day.
The test coverage is very good but not complete. Some web-related functionality is difficult to test in a unit test. Everything else should be covered.
History
This module was adapted from a private repository in December 2024. The Framework and Pages code moved to separate modules in November 2025.
统计信息
- 总下载量: 380
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-05