monirsaikat/php22
Composer 安装命令:
composer require monirsaikat/php22
包简介
A lightweight PHP framework for custom applications.
README 文档
README
To install: composer require monirsaikat/php22:dev-main
Request
The Request class provides a set of methods to interact with the HTTP request data, including inputs, query parameters, headers, cookies, files, and more.
Methods
isPost(): bool
- Description: Checks if the current request is a POST request.
- Returns:
trueif the request method is POST,falseotherwise.
isGet(): bool
- Description: Checks if the current request is a GET request.
- Returns:
trueif the request method is GET,falseotherwise.
input(string $key, $default = null)
- Description: Retrieves a specific input value from the POST data.
- Parameters:
$key(string): The key to retrieve from the input.$default(mixed): The default value if the key doesn't exist.
- Returns: The value associated with the key, or the default value.
all(): array
- Description: Retrieves all input data from the POST request.
- Returns: An associative array of all POST data.
query(string $key, $default = null)
- Description: Retrieves a specific query parameter from the GET data.
- Parameters:
$key(string): The key to retrieve from the query parameters.$default(mixed): The default value if the key doesn't exist.
- Returns: The value associated with the key, or the default value.
allQuery(): array
- Description: Retrieves all query parameters from the GET request.
- Returns: An associative array of all GET data.
header(string $key, $default = null)
- Description: Retrieves a specific header value.
- Parameters:
$key(string): The header name.$default(mixed): The default value if the header doesn't exist.
- Returns: The value of the specified header, or the default value.
headers(): array
- Description: Retrieves all headers from the current request.
- Returns: An associative array of all headers.
cookie(string $key, $default = null)
- Description: Retrieves a specific cookie value.
- Parameters:
$key(string): The cookie name.$default(mixed): The default value if the cookie doesn't exist.
- Returns: The value of the specified cookie, or the default value.
allCookies(): array
- Description: Retrieves all cookies from the current request.
- Returns: An associative array of all cookies.
file(string $key): ?array
- Description: Retrieves a specific uploaded file.
- Parameters:
$key(string): The file input name.
- Returns: An array containing file information, or
nullif not found.
allFiles(): array
- Description: Retrieves all uploaded files from the current request.
- Returns: An associative array of all uploaded files.
method(): string
- Description: Gets the HTTP request method.
- Returns: The request method as a string (e.g., 'GET', 'POST').
uri(): string
- Description: Gets the full request URI.
- Returns: The request URI as a string.
path(): string
- Description: Gets the request path without the query string.
- Returns: The request path as a string.
ip(): ?string
- Description: Gets the client's IP address.
- Returns: The IP address as a string, or
nullif not available.
isAjax(): bool
- Description: Checks if the request is an AJAX request.
- Returns:
trueif the request is an AJAX request,falseotherwise.
isSecure(): bool
- Description: Checks if the request is made over HTTPS.
- Returns:
trueif the request is secure,falseotherwise.
json(bool $assoc = true)
- Description: Retrieves JSON input data from the request body.
- Parameters:
$assoc(bool): Whether to return the data as an associative array (true) or an object (false).
- Returns: The decoded JSON data.
validate(array $rules): array
- Description: Validates the input data using the given rules.
- Parameters:
$rules(array): An associative array of validation rules (e.g.,['username' => 'required']).
- Returns: The validated data.
- Note: If validation fails, errors are flashed, and the user is redirected.
monirsaikat/php22 适用场景与选型建议
monirsaikat/php22 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 11 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 monirsaikat/php22 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 monirsaikat/php22 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-24