Skip to content

Commit

Permalink
Basic Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Muffinman committed Jan 17, 2023
1 parent 44f61bb commit dff981a
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,52 @@ Otherwise just download the package and add it to the autoloader.

## Usage

Create an API instance.
Retrieve an API Token.

```php
$nginx = Eighteen73\NginxProxyManager\NginxProxyManager::create($accessToken);
$accessToken = Eighteen73\NginxProxyManager\NginxProxyManager::createAccessToken($baseUrl, $username, $password);
```

Push a new record to the API
Create a new VHost
```php

$nginx = Eighteen73\NginxProxyManager\NginxProxyManager::create($baseUrl, $accessToken);
$nginx->hosts()->create([
'access_list_id' => '0', // ID of an Access List to restrict host
'advanced_config' => '', // Advanced Nginx rules
'allow_websocket_upgrade' => false
'block_exploits' => true,
'caching_enabled' => false,
'certificate_id' => "new", // Either ID of existing cert, or "new" to request a new cert
'domain_names' => ['example.com'], // Array of domains
'forward_host' => '127.0.0.1', // Backend server hostname or IP
'forward_port' => 8080, // Backend server port
'forward_scheme' => 'http', // Backend listen scheme/protocol
'hsts_enabled' => true,
'hsts_subdomains' => false,
'http2_support' => true,
'ssl_forced' => true,
'locations' => [], // Custom location directives for Nginx
'meta' => [
'letsencrypt_agree': false,
'dns_challenge': false,
],
]);
```

Update an existing record
```php

$nginx = Eighteen73\NginxProxyManager\NginxProxyManager::create($baseUrl, $accessToken);
$nginx->hosts()->update($id, [
// As create method above
]);
```

Delete a record
Delete a host
```php

$nginx = Eighteen73\NginxProxyManager\NginxProxyManager::create($baseUrl, $accessToken);
$nginx->hosts()->delete($id);
```

## Links ##
* [Nginx Proxy Manager](https://github.com/NginxProxyManager)
* [License](./LICENSE)

0 comments on commit dff981a

Please sign in to comment.