PHPackages                             pve2-api-client/pve2-api-client - 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. [API Development](/categories/api)
4. /
5. pve2-api-client/pve2-api-client

ActiveLibrary[API Development](/categories/api)

pve2-api-client/pve2-api-client
===============================

A Proxmox VE API v2 client with symfony

v1.0.5(2y ago)0293MITPHPPHP ^8.0|^8.1|^8.2

Since Sep 29Pushed 2y agoCompare

[ Source](https://github.com/Anuril/symfony-pve2-api-client)[ Packagist](https://packagist.org/packages/pve2-api-client/pve2-api-client)[ RSS](/packages/pve2-api-client-pve2-api-client/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (6)Versions (9)Used By (0)

PVE2 API wrapper for Symfony
============================

[](#pve2-api-wrapper-for-symfony)

This class provides the building blocks for someone wanting to use PHP to talk to Proxmox's API, and is using symfony anyway.

This is a fork and rewrite of [this](https://github.com/CpuID/pve2-api-php-client). This library probably isn't a drop-in replacement for it, but it should be relatively simple to fix your code.

Due to the nature of how the Proxmox VE API works, errors 500 / 501 will return null, otherwise requesting an invalid resource to see if it already exists doesn't work. Ideally, I'd like to work towards

Relatively simple piece of code, just provides a get/put/post/delete abstraction layer as methods on top of Proxmox's REST API, while also handling the Login Ticket headers required for authentication.

More information:
-----------------

[](#more-information)

See [http://pve.proxmox.com/wiki/Proxmox\_VE\_API](http://pve.proxmox.com/wiki/Proxmox_VE_API) for information about how this API works. API spec available at

Requirements:
-------------

[](#requirements)

PHP 8.1+ with symfony

Usage:
------

[](#usage)

Example - Return status array for each Proxmox Host in this cluster.

```
    require_once("./srv/pve2_api.class.php");

    # You can try/catch exception handle the constructor here if you want.
    $pve2 = new PVE2_API("hostname", "username", "realm", "password", port: "port", verify_ssl: true, tokenid: "tokenid", tokensecret: "tokensecret, debug: true);
    # realm above can be pve, pam or any other realm available.
    # if you provide tokenid and tokensecret, you can leave out username & password.
    # debug generates more verbose exceptions.
    # verify_ssl enables or disables ssl validation.

    if ($pve2->login()) {
        foreach ($pve2->get_node_list() as $node_name) {
            print_r($pve2->get("/nodes/".$node_name."/status"));
        }
    } else {
        print("Login to Proxmox Host failed.\n");
        exit;
    }

```

Example - Create a new Linux Container (LXC) on the first host in the cluster.

```
    require_once("./pve2-api-php-client/pve2_api.class.php");

    # You can try/catch exception handle the constructor here if you want.
    $pve2 = new PVE2_API("hostname", "username", "realm", "password", port: "port", verify_ssl: true, tokenid: "tokenid", tokensecret: "tokensecret, debug: true);
    # realm above can be pve, pam or any other realm available.

    if ($pve2->login()) {

        # Get first node name.
        $nodes = $pve2->get_node_list();
        $first_node = $nodes[0];
        unset($nodes);

        # Create a Linux Container (LXC) on the first node in the cluster.
        $new_container_settings = array();
        $new_container_settings['ostemplate'] = "local:vztmpl/debian-6.0-standard_6.0-4_amd64.tar.gz";
        $new_container_settings['vmid'] = "1234";
        $new_container_settings['cpus'] = "2";
        $new_container_settings['description'] = "Test VM using Proxmox 2.0 API";
        $new_container_settings['disk'] = "8";
        $new_container_settings['hostname'] = "testapi.domain.tld";
        $new_container_settings['memory'] = "1024";
        $new_container_settings['nameserver'] = "4.2.2.1";

        // print_r($new_container_settings);
        print("---------------------------\n");

        print_r($pve2->post("/nodes/".$first_node."/lxc", $new_container_settings));
        print("\n\n");
    } else {
        print("Login to Proxmox Host failed.\n");
        exit;
    }

```

Example - Modify DNS settings on an existing container on the first host.

```
    require_once("./pve2-api-php-client/pve2_api.class.php");

    # You can try/catch exception handle the constructor here if you want.
    $pve2 = new PVE2_API("hostname", "username", "realm", "password", port: "port", verify_ssl: true, tokenid: "tokenid", tokensecret: "tokensecret, debug: true);
    # realm above can be pve, pam or any other realm available.

    if ($pve2->login()) {

        # Get first node name.
        $nodes = $pve2->get_node_list();
        $first_node = $nodes[0];
        unset($nodes);

        # Update container settings.
        $container_settings = array();
        $container_settings['nameserver'] = "4.2.2.2";

        # NOTE - replace XXXX with container ID.
        var_dump($pve2->put("/nodes/".$first_node."/lxc/XXXX/config", $container_settings));
    } else {
        print("Login to Proxmox Host failed.\n");
        exit;
    }

```

Example - Delete an existing container.

```
    require_once("./pve2-api-php-client/pve2_api.class.php");

    # You can try/catch exception handle the constructor here if you want.
    $pve2 = new PVE2_API("hostname", "username", "realm", "password", port: "port", verify_ssl: true, tokenid: "tokenid", tokensecret: "tokensecret, debug: true);
    # realm above can be pve, pam or any other realm available.

    if ($pve2->login()) {
        # NOTE - replace XXXX with node short name, and YYYY with container ID.
        var_dump($pve2->delete("/nodes/XXXX/lxc/YYYY"));
    } else {
        print("Login to Proxmox Host failed.\n");
        exit;
    }

```

Licensed under the MIT License. See LICENSE file.

###  Health Score

29

—

LowBetter than 63% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 51.2% 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 ~0 days

Total

6

Last Release

904d ago

PHP version history (2 changes)v1.0.0PHP ^8.0|^8.2

V1.0.4PHP ^8.0|^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c66140a305dd8d1d97f67422f11a50b044ed680cf678a723ad285bc2eabb0f9?d=identicon)[Anuril](/maintainers/Anuril)

---

Top Contributors

[![CpuID](https://avatars.githubusercontent.com/u/916201?v=4)](https://github.com/CpuID "CpuID (22 commits)")[![Anuril](https://avatars.githubusercontent.com/u/1939311?v=4)](https://github.com/Anuril "Anuril (8 commits)")[![ThomasLamprecht](https://avatars.githubusercontent.com/u/526413?v=4)](https://github.com/ThomasLamprecht "ThomasLamprecht (4 commits)")[![lsthompson](https://avatars.githubusercontent.com/u/73861168?v=4)](https://github.com/lsthompson "lsthompson (3 commits)")[![lucapiccio](https://avatars.githubusercontent.com/u/93374781?v=4)](https://github.com/lucapiccio "lucapiccio (2 commits)")[![danhunsaker](https://avatars.githubusercontent.com/u/1534396?v=4)](https://github.com/danhunsaker "danhunsaker (2 commits)")[![spamhome](https://avatars.githubusercontent.com/u/82236456?v=4)](https://github.com/spamhome "spamhome (1 commits)")[![ypilpre](https://avatars.githubusercontent.com/u/5433576?v=4)](https://github.com/ypilpre "ypilpre (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pve2-api-client-pve2-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/pve2-api-client-pve2-api-client/health.svg)](https://phpackages.com/packages/pve2-api-client-pve2-api-client)
```

###  Alternatives

[mtarld/api-platform-ms-bundle

API Platform Microservice Bundle

7124.5k](/packages/mtarld-api-platform-ms-bundle)[stfalcon-studio/api-bundle

Base classes and helper services to build API application via Symfony.

1031.0k](/packages/stfalcon-studio-api-bundle)

PHPackages © 2026

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