PHPackages                             tourze/server-node-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. tourze/server-node-bundle

ActiveSymfony-bundle[DevOps &amp; Deployment](/categories/devops)

tourze/server-node-bundle
=========================

提供服务器节点管理功能的Symfony包，包括SSH连接、节点状态监控、负载统计等功能

1.1.0(6mo ago)07194MITPHPCI passing

Since May 20Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/tourze/server-node-bundle)[ Packagist](https://packagist.org/packages/tourze/server-node-bundle)[ RSS](/packages/tourze-server-node-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (8)Dependencies (42)Versions (9)Used By (4)

Server Node Bundle
==================

[](#server-node-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/24f7cd6a8e3a4a4cf7bf6c2994a8c2a158dcd708c69c3411e067fd33a80141b1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f7365727665722d6e6f64652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/server-node-bundle)[![PHP Version](https://camo.githubusercontent.com/36b7d88b40b9a25a6d18c3848476aff86ae2970ab37802ba834bba4ecdbf86f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f7365727665722d6e6f64652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/server-node-bundle)[![Build Status](https://camo.githubusercontent.com/71c899315a8f155d504bb23baebabdd724ea15a42a5f7e72e49e6b4e9ebc30d3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f75727a652f7068702d6d6f6e6f7265706f2f746573742e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/tourze/php-monorepo/actions)[![License](https://camo.githubusercontent.com/58c78e08be35d375f81c5330b675509b0cf492c3eef8bce4c099b2249ab02f5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f7365727665722d6e6f64652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/server-node-bundle)[![Code Coverage](https://camo.githubusercontent.com/73ee3bab50824f778cedc6b4b3f78bcdab621eef812a979ec388b8ad692a4bff/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f746f75727a652f7068702d6d6f6e6f7265706f2e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/tourze/php-monorepo)

A comprehensive server node management bundle for Symfony applications, providing server monitoring, SSH management, and traffic statistics.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Advanced Usage](#advanced-usage)
- [API Reference](#api-reference)
- [Security](#security)
- [Contributing](#contributing)
- [License](#license)

Features
--------

[](#features)

- **Server Node Management**: Complete CRUD operations for server nodes
- **SSH Connection Support**: Secure SSH connection management with password or key authentication
- **Traffic Monitoring**: Real-time monitoring of upload/download traffic and bandwidth
- **System Information**: Automatic collection of server hardware and system information
- **Status Management**: Track node status (online, offline, maintenance, etc.)
- **EasyAdmin Integration**: Ready-to-use admin interface with `tourze/easy-admin-menu-bundle`
- **API Key Management**: Secure API key generation and management
- **Multi-Country Support**: Built-in support for international server locations

Installation
------------

[](#installation)

```
composer require tourze/server-node-bundle
```

Quick Start
-----------

[](#quick-start)

### Requirements

[](#requirements)

- PHP 8.1+
- Symfony 6.4+
- Doctrine ORM 3.0+
- EasyAdmin Bundle 4+

### Configuration

[](#configuration)

#### 1. Bundle Registration

[](#1-bundle-registration)

Add the bundle to your `config/bundles.php`:

```
return [
    // ...
    ServerNodeBundle\ServerNodeBundle::class => ['all' => true],
];
```

#### 2. Database Schema

[](#2-database-schema)

Create the database table:

```
php bin/console doctrine:schema:update --force
```

### Basic Usage

[](#basic-usage)

#### Creating a Server Node

[](#creating-a-server-node)

```
use ServerNodeBundle\Entity\Node;
use ServerNodeBundle\Enum\NodeStatus;

$node = new Node();
$node->setName('Production Server 1');
$node->setSshHost('192.168.1.100');
$node->setSshPort(22);
$node->setSshUser('root');
$node->setSshPassword('your-password');
$node->setStatus(NodeStatus::ONLINE);
$node->setValid(true);

$entityManager->persist($node);
$entityManager->flush();
```

### Repository Usage

[](#repository-usage)

```
use ServerNodeBundle\Repository\NodeRepository;

class YourService
{
    public function __construct(private NodeRepository $nodeRepository)
    {
    }

    public function getActiveNodes(): array
    {
        return $this->nodeRepository->findBy(['valid' => true]);
    }

    public function getOnlineNodes(): array
    {
        return $this->nodeRepository->findBy(['status' => NodeStatus::ONLINE]);
    }
}
```

### Node Properties

[](#node-properties)

The Node entity includes comprehensive server information:

- **Basic Info**: Name, country, domain, SSH credentials
- **System Info**: Hostname, OS version, kernel version, architecture
- **Hardware Info**: CPU model, frequency, core count, virtualization tech
- **Network Info**: Bandwidth, online IP, TCP congestion control
- **Traffic Stats**: Total, upload, download flow statistics
- **Status**: Current operational status and user count

Advanced Usage
--------------

[](#advanced-usage)

### Admin Interface

[](#admin-interface)

The bundle automatically provides admin menu integration when using `tourze/easy-admin-menu-bundle`. The menu includes:

- **Server Management**
    - Server Nodes (with full CRUD operations)

### Custom Node Status Handling

[](#custom-node-status-handling)

```
use ServerNodeBundle\Enum\NodeStatus;

// Check node status
if ($node->getStatus() === NodeStatus::OFFLINE) {
    // Handle offline node
    $this->logger->warning('Node is offline', ['node' => $node->getName()]);
}

// Update node status
$node->setStatus(NodeStatus::MAINTAIN);
$this->entityManager->flush();
```

### SSH Connection Management

[](#ssh-connection-management)

```
use ServerNodeBundle\Exception\SshConnectionException;

try {
    // Your SSH connection logic here
    $connection = $this->sshService->connect($node);
} catch (SshConnectionException $e) {
    $this->logger->error('SSH connection failed', [
        'node' => $node->getName(),
        'error' => $e->getMessage()
    ]);
}
```

API Reference
-------------

[](#api-reference)

### Node Status Enum

[](#node-status-enum)

```
use ServerNodeBundle\Enum\NodeStatus;

// Available statuses
NodeStatus::INIT;           // 初始化
NodeStatus::ONLINE;         // 正常
NodeStatus::OFFLINE;        // 离线
NodeStatus::BANDWIDTH_OVER; // 流量用完
NodeStatus::MAINTAIN;       // 维护中
```

### SSH Connection Exception

[](#ssh-connection-exception)

```
use ServerNodeBundle\Exception\SshConnectionException;

try {
    // SSH connection logic
} catch (SshConnectionException $e) {
    // Handle SSH connection errors
    echo $e->getMessage();
}
```

Security
--------

[](#security)

This bundle handles sensitive information like SSH credentials. Please ensure:

- Use environment variables for sensitive configuration
- Enable proper access controls on admin interfaces
- Regularly rotate SSH keys and passwords
- Monitor access logs for unauthorized attempts

For security vulnerabilities, please email  instead of using the issue tracker.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](https://github.com/tourze/php-monorepo/blob/master/CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance67

Regular maintenance activity

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Recently: every ~52 days

Total

8

Last Release

196d ago

Major Versions

0.0.5 → 1.0.02025-11-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13899502?v=4)[tourze](/maintainers/tourze)[@tourze](https://github.com/tourze)

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (5 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-server-node-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-server-node-bundle/health.svg)](https://phpackages.com/packages/tourze-server-node-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M736](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.8k](/packages/contao-core-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
