seiler/directive

此包已被弃用,不再维护。未建议替代包。

一个用于操作nginx配置的PHP库

v1.0.2 2020-12-20 17:10 UTC

This package is auto-updated.

Last update: 2022-09-20 21:12:37 UTC


README

Software License

Directive帮助您轻松地在PHP中操作Nginx配置。

要求

PHP 7.3 > 8.0

安装

$ composer require seiler/directive
<?php

use Seiler\Directive;

用法

  1. 加载Nginx配置
$config = file_get_contents('/path/to/nginx/config/file.conf');

$directive = Directive::fromString($config);
  1. 添加您的更改
$directive->server->serverName->value('example.org');
  1. 保存您的更改
file_put_contents('/path/to/nginx/config/file.conf', $directive);

许可

MIT许可(MIT)。请参阅许可文件以获取更多信息。