/nginx-unit-php-sdk

Nginx Unit PHP SDK allows developers to interact with the Nginx Unit web server through php classes. This project will help embed web server management into your projects

Primary LanguagePHPApache License 2.0Apache-2.0

Company logo

PHP SDK for Nginx Unit

About

SDK allows developers to interact with the Nginx Unit web server through php classes. This project will help embed web server management into your projects

Supported Versions

Version Nginx Unit Capability Supported
0.6.x 1.30.0 & 1.31.0
< 0.4.x 1.30.0

THIS PROJECT IN DEVELOPMENT. DON'T USE IT IN PRODUCTION

Quick start

Pre-requirements

Installation

  1. Create folder mkdir example-php-project
  2. Open folder cd example-php-project
  3. Crate composer.json file. Example below:
{
  "name": "user/example-php-project",
  "require": {
    "pavlusha311245/unit-php-sdk": "^0.6.0"
  },
  "autoload": {
    "psr-4": {
      "User\\ExamplePhpProject\\": "src/"
    }
  }
}
  1. Install packages composer install

Congratulations! You installed package. Now you can use the full power of this SDK.

  • Create src/index.php file
    1. cd src (mkdir src if folder doesn't exist)
    2. touch src/index.php
    3. nano src/index.php
  • Paste code and change this line socket: <your socket path to Nginx Unit> for your configuration
<?php

use UnitPhpSdk\Unit;

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

$unit = new Unit(
    socket: <your socket path to Nginx Unit>,
    address: 'http://localhost'
);

$unit->getConfig();
  • Run php index.php

Documentation

More examples and detailed information can be found in the documentation

Happy coding 😊

Changelog

More information about changes you can see here

Contribution

More info about contribution you can read here

Security Policy

If you find bugs and vulnerabilities, please contact unit@pavlusha.me.

More info here