shlinkio / shlink-installer
A PHP command line tool used to install shlink
Installs: 45 894
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 3
Forks: 3
Open Issues: 3
Requires
- php: ^8.2
- 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
- webimpress/safe-writer: ^2.2
Requires (Dev)
- devster/ubench: ^2.1
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^11.3
- roave/security-advisories: dev-master
- shlinkio/php-coding-standard: ~2.4.0
- symfony/var-dumper: ^7.1
- dev-develop
- v9.3.0
- 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-12-20 08:26:03 UTC
README
A PHP command line tool used to install shlink.
Installation
Install this tool using composer.
composer install shlinkio/shlink-installer
Usage
This is the command line tool used by shlink to guide you through the installation process.
The tool expects the working directory to be a valid shlink instance.
In order to run it, use the built-in CLI entry point.
Run vendor/bin/shlink-installer
to print all available commands.
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.
The most important ones are these:
install
: Used to set up Shlink from scratch.update
: Used to update an existing Shlink instance. Will allow importing the config, skipping the options that already have a value.set-option
: Allows to set the value for an individual option, in case you want to update it.
Customize options
Questions to ask the user
In order to retain backwards compatibility, it is possible to configure the installer to ask just a specific subset of questions.
Add a configuration file including a configuration like this:
<?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, ], ], ];
If
installer.enabled_options
is not provided at all, all the config options will be asked.
Commands to run after installation
After the user has been asked for all the config, the installer will run a set of scripts which will create/update the database, download assets, etc.
It is possible to overwrite those commands via configuration too, using a syntax like this:
<?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 ], ], ], ];
This example shows all the currently available commands. They are run in the order they have been set here.
Important: Take into consideration that all the commands must be PHP scripts, since the installer will prefix all of them with the php binary.