定制 lawrencekm/server-info 二次开发

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

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

lawrencekm/server-info

Composer 安装命令:

composer require lawrencekm/server-info

包简介

A package to retrieve server information

README 文档

README

Server Info Package

A PHP package for retrieving Server information and System services details for monitoring purposes.

Installation

To install the package in your PHP project:

    composer require lawrencekm/server-info

You can also Clone the repository or download the source code.

    git clone https://github.com/lawrencekm/server-info.git

Install dependencies using Composer.

    composer install

Usage

To use the Server Info package, follow these steps:

Initialize the ServerInfo class in your PHP code.

    require __DIR__ . '/vendor/autoload.php';

    $serverInfo = new ServerInfo();
    Retrieve server information in JSON format.

    echo $serverInfo->getServerInformation();
    //Optionally, you can render the information as an HTML table.

    // echo $serverInfo->getServerInformation(); // Uncomment this line if not already called
    $data = json_decode($serverInfo->getServerInformation(), true);


    // Render HTML tables

Testing

To run tests using PHPUnit, follow these steps:

Ensure PHPUnit is installed as a development dependency. composer install --dev Run PHPUnit tests. ./vendor/bin/phpunit tests

Running as Web Server

You can run the application as a web server using Docker. Choose one of the following methods:

Method 1: Dockerfile

Create a Dockerfile with the following content:

```
FROM php:8.2-apache
COPY . /var/www/html/
```

Build and run the Docker container: docker build -t my-server-info . docker run -p 8080:80 -d my-server-info

Method 2: Without Dockerfile

Run the following Docker command to get the output on browser localhost:8080:

docker run -d -p 8080:80 --name my-server-info-php-app -v "$PWD":/var/www/html php:8.2-apache

Run Via Command Line

You can also run index.php file via the command line to get a json response:

php index.php

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-05