定制 rmunate/info-server 二次开发

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

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

rmunate/info-server

最新稳定版本:v2.3.0

Composer 安装命令:

composer require rmunate/info-server

包简介

The System Library allows you to query all information related to existing server-side variables, values, and configurations (Server Variables, Environment Variables, PHP Values, and Configurations). It provides an easy and convenient way to work with server data.

README 文档

README

This package allows you to access all information related to server-side variables, values, and configurations (Server Variables, Environment Variables, PHP Values, and their configurations). It provides an easy and convenient way to work with server data.

⚙️ This library is compatible with Laravel versions 8.0 and above ⚙️

Laravel 8.0+ Laravel 9.0+ Laravel 10.0+

logo-info-server

📖 DOCUMENTATION IN SPANISH 📖

Table of Contents

Installation

To install the package via Composer, execute the following command:

composer require rmunate/info-server

Available Methods

PHP Information

Method Description and Return
PHP::uname() Retrieves the operating system on which PHP is running.
PHP::version() Retrieves the current PHP version in "major.minor.edition[extra]" notation.
PHP::majorversion() Retrieves the current "major version" of PHP as an integer (e.g., int(5) in version "5.2.7-extra").
PHP::minorVersion() Retrieves the current "minor version" of PHP as an integer (e.g., int(2) in version "5.2.7-extra").
PHP::releaseVersion() Retrieves the PHP release version.
PHP::versionId() Retrieves the PHP version id.
PHP::extraVersion() Retrieves the PHP "extra" version as a string (e.g., '-extra' in version "5.2.7-extra"). Often used by distributors to indicate the package version.
PHP::maxpathlen() Retrieves the maximum length of file (including directories) names supported by the PHP build.
PHP::os() Retrieves the operating system for which PHP was built.
PHP::osFamily() Retrieves the family of operating systems for which PHP was built. Can be 'Windows', 'BSD', 'OSX', 'Solaris', 'Linux', or 'Unknown'. Available since PHP 7.2.0.
PHP::intMax() Retrieves the largest integer supported in this PHP build. Normally int(2147483647) on 32-bit systems and int(9223372036854775807) on 64-bit systems.
PHP::intMin() Retrieves the smallest integer supported in this PHP build. Normally int(-2147483648) on 32-bit systems and int(-9223372036854775808) on 64-bit systems. Typically, PHP_INT_MIN === ~PHP_INT_MAX.
PHP::intSize() Retrieves the size of an integer in bytes in this PHP build.
PHP::floatDig() Retrieves the number of decimal digits that can be rounded and reversed in a floating-point number without loss of precision. Available since PHP 7.2.0.
PHP::floatEpsilon() Retrieves the smallest positive floating-point number x such that x + 1.0 != 1.0. Available since PHP 7.2.0.
PHP::floatMin() Retrieves the smallest positive floating-point number that can be represented. To get the smallest representable negative floating-point number, use -PHP_FLOAT_MAX. Available since PHP 7.2.0.
PHP::floatMax() Retrieves the largest floating-point number that can be represented. Available since PHP 7.2.0.
PHP::getIniSettings() Retrieves the complete information of PHP configuration (php.ini settings). Returns an associative array with configuration settings or null if there is an error.
PHP::getActiveExtensions() Retrieves the list of active PHP extensions. Returns an array with the names of active extensions or null if there is an error.

Usage Examples

use Rmunate\InfoServer\Wrappers\PHP;

PHP::floatMin(); 
//2.2250738585072E-308

PHP::intMax(); 
//9223372036854775807

PHP::version()
//"8.1.21"

Environment Variables

Retrieve any available value in the environment variables and validate if the variable exists.

Method Description and Return
Environment::has($key) Determines if the given configuration value exists.
Environment::get($key, $default = null) Gets the environment variable with the given key. If not found, returns the default value (if provided).
Environment::all() Gets all environment variables.

Usage Examples

use Rmunate\InfoServer\Wrappers\Environment;

Environment::has("APP_NAME"); 
//true

Environment::get("APP_NAME","UNDEFINED"); 
//CODE MAESTRO

Environment::all()
// {#401 ▼ // routes/web.php:45
//   +"APP_NAME": "CODE MAESTRO"
//   +"APP_KEY": "base64:c3FCNjkhomKMSHgE5gxF5gy7qrswb77iFXUA1YvGvJE="
//   +"APP_DEBUG": "true"
//   +"APP_URL": "http://localhost"
//   ...

Server Information

Finally, you have a range of methods to know server values.

Method Description
Server::has($variable) Verifies if a specific server variable is defined.
Server::get($variable) Gets the value of a specific server variable.
Server::all() All data variable $_SERVER.
Server::user() Gets the user running the PHP script, if available.
Server::home() Gets the home directory of the user, if available.
Server::scriptName() Gets the current script's path and name. Useful for self-referencing pages.
Server::requestUri() Gets the URI used to access the page.
Server::queryString() Gets the query string of the current request, if available.
Server::requestMethod() Gets the request method used to access the page.
Server::protocol() Gets the name and revision number of the information protocol through which the page was requested.
Server::gatewayInterface() Gets the CGI specification revision used by the server.
Server::redirectUrl() Gets the URL after the redirection, if available.
Server::remotePort() Gets the port used by the user's machine to communicate with the web server.
Server::scriptFilename() Gets the absolute path and name of the currently running script.
Server::admin() Gets the value of the SERVER_ADMIN directive (from Apache) in the server's configuration file. If the script is running on a virtual host, the value will be the one defined for that virtual host.
Server::contextDocumentRoot() Gets the document root of the current script without a trailing slash.
Server::contextPrefix() Method without documentation for newer Apache versions.
Server::requestScheme() Gets the scheme used in the request, either "HTTP" or "HTTPS".
Server::documentRoot() Gets the server's root directory as defined in the server's configuration file.
Server::remoteAddr() Gets the IP address from which the current user is viewing the page.
Server::port() Gets the server's port used for communication. By default, the value will be '80'. If SSL is used, for example, this value will change to the one defined for the secure HTTP port.
Server::addr() Gets the IP address of the server where the script is currently running.
Server::name() Gets the name of the server where the script is currently running. If the script is running on a virtual host, the value will be the one defined for that virtual host.
Server::software() Gets the server software identification string provided in the response headers to requests.
Server::signature() Gets the server signature string containing the server's version and virtual host name. It is added to pages generated by the server if this feature is enabled.
Server::path() Gets the value of the PATH environment variable. Returns the raw value of the 'Cookie' header sent by the user agent.
Server::httpCookie() Gets the 'Cookie' header sent by the user agent.
Server::httpAcceptLanguage() Gets the 'Accept-Language' header of the current request, if available.
Server::httpAcceptEncoding() Gets the 'Accept-Encoding' header of the current request, if available.
Server::httpSecFetchDest() Gets the 'Sec-Fetch-Dest' header of the current request, if available.
Server::httpSecFetchUser() Gets the 'Sec-Fetch-User' header of the current request, if available.
Server::httpSecFetchMode() Gets the 'Sec-Fetch-Mode' header of the current request, if available.
Server::httpSecFetchSite() Gets the 'Sec-Fetch-Site' header of the current request, if available.
Server::httpAccept() Gets the 'Accept' header of the current request, if available.
Server::httpUserAgent() Gets the 'User-Agent' header of the current request, if available. This is a string indicating the user agent used to access the page.
Server::httpUpgradeInsecureRequests() Gets the value of the 'Upgrade-Insecure-Requests' header of the current request, if available.
Server::httpSecChUaPlatform() Gets the platform of the user's connection, if available.
Server::httpSecChUaMobile() Gets the mobile connection platform, if available.
Server::httpHost() Gets the 'Host' header of the current request, if available.
Server::requestTimeFloat() Gets the timestamp of the request start with microsecond precision. Available since PHP 5.4.0.
Server::requestTime() Gets the Unix timestamp of the request start. Available since PHP 5.1.0.

Usage Examples

use Rmunate\InfoServer\Wrappers\Server;

Server::software();
//"PHP 8.1.21 Development Server"

Server::httpAccept();
//"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"

Server::has("AWS_ACCESS_KEY_ID");
//true - false

Creator

License

This project is under the MIT License.

🌟 Support My Projects! 🚀

Make any contributions you see fit; the code is entirely yours. Together, we can do amazing things and improve the world of development. Your support is invaluable. ✨

If you have ideas, suggestions, or just want to collaborate, we are open to everything! Join our community and be part of our journey to success! 🌐👩‍💻👨‍💻

rmunate/info-server 适用场景与选型建议

rmunate/info-server 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 275 次下载、GitHub Stars 达 7, 最近一次更新时间为 2023 年 01 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「server」 「laravel」 「rmunate」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 rmunate/info-server 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rmunate/info-server 我们能提供哪些服务?
定制开发 / 二次开发

基于 rmunate/info-server 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-05