A PHP command line tool used to install shlink
A PHP command line tool used to install shlink.
Install this tool using composer.
composer install shlinkio/shlink-installer
This is the command line tool used by shlink to guide you through the installation process.
The tool expects the active directory to be a valid shlink instance.
There are two main ways to run this tool:
Using the built-in CLI entry points.
vendor/bin/shlink-updatein order to install or update a shlink instance.
This script returns two functions that can be used to either install or update a shlink instance.
Just require it and invoke the appropriate function:
<?php declare(strict_types=1); [$install, $update] = require 'vendor/shlinkio/shlink-installer/bin/run.php'; $install(); // To install $update(); // To update
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, ], ], ];
installer.enabled_optionsis not provided at all, all the config options will be asked.
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); return [ 'installer' => [ 'installation_commands' => [ 'db_create_schema' => [ 'command' => 'bin/shlink shlink:db:create', ], 'db_migrate' => [ 'command' => 'bin/some-script some:command', ], 'orm_proxies' => [ '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.