PHP code example of webnitros / nginx-proxy-manager

1. Go to this page and download the library: Download webnitros/nginx-proxy-manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webnitros / nginx-proxy-manager example snippets


# клиент
use NginxProxyManager\Rest;
use NginxProxyManager\Token;

$Token = new Token();
$Client = new Rest();

use NginxProxyManager\Meta\Domain;

# создание домена
$Domain = Domain::create($Client);
$Domain
   ->addDomain('site.ru')
   ->forwardHost('127.0.0.1')
   ->forwardPort(80)
   ->forwardScheme('http')
   //->ssl('') // Покдлючение SSL сертификата (домен должен быть направлен на сервер)
;
$Domain->save();

use NginxProxyManager\Meta\Domain;

# Получить домена по id
$Domain = Domain::object(1,$Client);

# Удалить домена
$Domain = Domain::object(1,$Client);
$Domain->delete()

# поиск домена
$Domain = Domain::search('site.ru',$Client);


nano nano bootstrap.php

rs\Env::loadFile(dirname(__FILE__, 1) . '/.env');