shlinkio / shlink-installer
一个用于安装 shlink 的 PHP 命令行工具
v9.2.0
2024-08-11 16:23 UTC
Requires
- php: ^8.2
- laminas/laminas-config: ^3.9
- laminas/laminas-config-aggregator: ^1.15
- laminas/laminas-servicemanager: ^4.2 || ^3.22
- laminas/laminas-stdlib: ^3.19
- shlinkio/shlink-config: ^3.1
- symfony/console: ^7.1
- symfony/filesystem: ^7.1
- symfony/process: ^7.1
Requires (Dev)
- devster/ubench: ^2.1
- phpstan/phpstan: ^1.11
- phpstan/phpstan-phpunit: ^1.4
- phpunit/phpunit: ^11.3
- roave/security-advisories: dev-master
- shlinkio/php-coding-standard: ~2.3.0
- symfony/var-dumper: ^7.1
- dev-develop
- v9.2.0
- v9.1.0
- v9.0.0
- v8.7.0
- v8.6.1
- v8.6.0
- v8.5.0
- v8.4.2
- v8.4.1
- v8.4.0
- v8.3.0
- v8.2.0
- v8.1.0
- v8.0.0
- v7.1.0
- v7.0.2
- v7.0.1
- v7.0.0
- v6.3.0
- v6.2.1
- v6.2.0
- v6.1.0
- v6.0.0
- v5.4.0
- v5.3.0
- v5.2.0
- v5.1.1
- v5.1.0
- v5.0.0
- v4.4.0
- v4.3.2
- v4.3.1
- v4.3.0
- v4.2.0
- v4.1.0
- v4.0.1
- v4.0.0
- v3.3.0
- v3.2.0
- v3.1.0
- v3.0.0
- v2.1.0
- v2.0.0
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
- dev-main
This package is auto-updated.
Last update: 2024-09-11 16:32:31 UTC
README
一个用于安装 shlink 的 PHP 命令行工具。
安装
使用 composer 安装此工具。
composer install shlinkio/shlink-installer
用法
这是 shlink(shlink)使用的命令行工具,用于指导您完成安装过程。
工具期望工作目录为有效的 shlink 实例。
要运行它,请使用内置的 CLI 入口点。
运行 vendor/bin/shlink-installer
以打印所有可用命令。
Shlink installer
Usage:
command [options] [arguments]
Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Display help for a command
install Guides you through the installation process, to get Shlink up and running.
list List commands
set-option Allows you to set new values for any config option.
update Helps you import Shlink's config from an older version to a new one.
其中最重要的命令是这些
install
:用于从头开始设置 Shlink。update
:用于更新现有的 Shlink 实例。将允许导入配置,跳过已具有值的选项。set-option
:允许设置单个选项的值,如果您想更新它。
自定义选项
要向用户提出的问题
为了保持向后兼容性,可以将安装程序配置为仅询问特定子集的问题。
添加包含如下配置的配置文件
<?php declare(strict_types=1); use Shlinkio\Shlink\Installer\Config\Option; return [ 'installer' => [ 'enabled_options' => [ Option\Database\DatabaseDriverConfigOption::class, Option\Database\DatabaseHostConfigOption::class, Option\BasePathConfigOption::class, Option\Redirect\Regular404RedirectConfigOption::class, Option\UrlShortener\ShortDomainHostConfigOption::class, Option\UrlShortener\ShortDomainSchemaConfigOption::class, ], ], ];
如果未提供
installer.enabled_options
,则将询问所有配置选项。
安装后要运行的命令
在用户已经回答了所有配置后,安装程序将运行一系列脚本,这些脚本将创建/更新数据库、下载资产等。
也可以通过配置覆盖这些命令,使用如下语法
<?php declare(strict_types=1); use Shlinkio\Shlink\Installer\Util\InstallationCommand; return [ 'installer' => [ 'installation_commands' => [ InstallationCommand::DB_CREATE_SCHEMA->value => [ 'command' => 'bin/shlink shlink:db:create', ], InstallationCommand::DB_MIGRATE->value => [ 'command' => 'bin/some-script some:command', ], InstallationCommand::ORM_PROXIES->value => [ 'command' => '-v', // Just print PHP version ], ], ], ];
此示例显示了所有当前可用的命令。它们将按此处设置的顺序运行。
重要:请考虑所有命令都必须是 PHP 脚本,因为安装程序将所有这些命令都前缀为 php 二进制文件。