https://github.com/client-api/pmg-php
PHP SDK for the Proxmox Mail Gateway (PMG) API.
https://github.com/client-api/pmg-php
anti-spam api-client composer guzzle mail-gateway openapi openapi-generator php pmg proxmox proxmox-mail-gateway sdk
Last synced: 20 days ago
JSON representation
PHP SDK for the Proxmox Mail Gateway (PMG) API.
- Host: GitHub
- URL: https://github.com/client-api/pmg-php
- Owner: client-api
- License: apache-2.0
- Created: 2026-05-23T13:31:43.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-05-24T20:00:38.000Z (about 1 month ago)
- Last Synced: 2026-05-25T00:14:50.192Z (about 1 month ago)
- Topics: anti-spam, api-client, composer, guzzle, mail-gateway, openapi, openapi-generator, php, pmg, proxmox, proxmox-mail-gateway, sdk
- Language: PHP
- Homepage:
- Size: 420 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pmg-php
PHP SDK for the Proxmox Mail Gateway API. Generated from
the upstream `apidoc.js` from Proxmox Mail Gateway via [openapi-generator-cli][gen] with custom
Mustache template overrides.
> **Not an official Proxmox project.** Community SDK derived from the
> upstream `apidoc.js`. Always verify against the upstream API viewer.
> .
Requires PHP ≥ 7.4.
## Install
```bash
composer require client-api/pmg
```
## Usage
```php
setHost('https://pmg1.example.com:8006/api2/json')
->setApiKey('Authorization', 'PMGAPIToken=user@realm!tokenid=uuid-secret');
$pve = new Pmg($cfg);
// Per-tag accessors are lazily instantiated and share the same Configuration.
$status = $pmg->qemu()->qemuVmStatus(node: 'pmg1', vmid: 100);
$nodes = $pmg->nodes()->nodesGetNodes();
```
The unified `Pmg` class wraps each per-tag API class (`QemuApi`,
`LxcApi`, `ClusterApi`, `NodesApi`, …) so consumers don't need to
instantiate them individually.
## Compound configs
PVE encodes many fields as CLI-style shorthand strings
(`net0=virtio,bridge=vmbr0,firewall=1`). Round-trip helpers are
emitted for every compound config schema:
```php
use ClientApi\Pmg\Model\PveQemuNetConfig;
$cfg = new PveQemuNetConfig([
'model' => 'virtio',
'bridge' => 'vmbr0',
'firewall' => 1,
]);
$shorthand = $cfg->toShorthand();
// → 'virtio,bridge=vmbr0,firewall=1'
$parsed = PveQemuNetConfig::fromShorthand($shorthand);
```
## Indexed families
Numbered properties (`net0..net31`, `mp0..mp255`, …) are exposed on
every model as a single collapsed `getNets()` / `setNets()` accessor.
The per-index `getNet0`/`setNet0`/… methods are filtered out of the
class surface (the wire format is preserved internally via a `__call`
magic dispatcher):
```php
$req->setNets([
0 => 'virtio,bridge=vmbr0',
3 => 'e1000,bridge=vmbr1',
]);
// Wire format: { "net0": "virtio,bridge=vmbr0", "net3": "e1000,bridge=vmbr1" }
```
## License
Apache 2.0 — see [LICENSE](./LICENSE).
[gen]: https://openapi-generator.tech