A PHP command line tool used to install shlink

Overview

Shlink installer

A PHP command line tool used to install shlink.

Build Status Code Coverage Latest Stable Version License Paypal donate

Shlink installer

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 active directory to be a valid shlink instance.

There are two main ways to run this tool:

  • Using 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            Force ANSI output
    --no-ansi         Disable 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        Displays help for a command
    install     Guides you through the installation process, to get Shlink up and running.
    list        Lists 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.
    

    You can also run vendor/bin/shlink-install or vendor/bin/shlink-update, which alias the install and update commands respectively, but this is deprecated and will be removed in next major release.

  • Using the bin/run.php helper script.

    This script returns three functions that can be used to run the install or update, or the whole shlink installer tool.

    Just require it and invoke the appropriate function:

    
    
    declare(strict_types=1);
    
    [$install, $update, $installer] = require 'vendor/shlinkio/shlink-installer/bin/run.php';
    $install(); // To install
    $update(); // To update
    $installer(); // To run any supported commands

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:



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:



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.

You might also like...
Twitter raffles in the command line, with PHP and minicli
Twitter raffles in the command line, with PHP and minicli

Rafflebird Rafflebird is a highly experimental CLI application for giveaways / raffles on Twitter, built in PHP with Minicli. Disclaimer: The recent s

Command-line control panel for Nginx Server to manage WordPress sites running on Nginx, PHP, MySQL, and Let's Encrypt
Command-line control panel for Nginx Server to manage WordPress sites running on Nginx, PHP, MySQL, and Let's Encrypt

EasyEngine v4 EasyEngine makes it greatly easy to manage nginx, a fast web-server software that consumes little memory when handling increasing volume

Generic PHP command line flags parse library
Generic PHP command line flags parse library

PHP Flag Generic PHP command line flags parse library Features Generic CLI options and arguments parser. Support set value data type(int,string,bool,a

🍃 In short, it's like Tailwind CSS, but for the PHP command-line applications.
🍃 In short, it's like Tailwind CSS, but for the PHP command-line applications.

Termwind Termwind allows you to build unique and beautiful PHP command-line applications, using the Tailwind CSS API. In short, it's like Tailwind CSS

php command line script to DCA crypto from Coinbase Pro

dca.php A simple php script designed to be run via the command line via a cron job. This will connect to coinbase pro and buy the crypto coins specifi

A PHP library for command-line argument processing

GetOpt.PHP GetOpt.PHP is a library for command-line argument processing. It supports PHP version 7.1 and above. Releases For an overview of the releas

BetterWPCLI - a small, zero-dependencies, PHP library that helps you build enterprise WordPress command-line applications.
BetterWPCLI - a small, zero-dependencies, PHP library that helps you build enterprise WordPress command-line applications.

BetterWPCLI - a small, zero-dependencies, PHP library that helps you build enterprise WordPress command-line applications.

Command-Line Interface tools

Aura.Cli Provides the equivalent of request ( Context ) and response ( Stdio ) objects for the command line interface, including Getopt support, and a

Another Command Line Argument Parser

Optparse — Another Command Line Argument Parser Install 1. Get composer. 2. Put this into your local composer.json: { "require": { "chh/optparse

Comments
  • Check all required PHP extensions are installed during shlink installation

    Check all required PHP extensions are installed during shlink installation

    Some users have had problems due to missing PHP extensions. It would be helpful having a simple check during the installation process which displays a human-friendly error indicating it.

    enhancement blocked 
    opened by acelaya 2
  • Improve the set-option command

    Improve the set-option command

    • When an option is changed that has other dependant options, ask the dependant options afterwards, explaining why. For example, if the database driver is changed from SQLite to MySQL, ask for credentials, port, etc.
    • When an option is changed that depends on other options, ask for the options it depends from as well. That could, in turn, take us to previous point.
    • Exclude swoole options from the list if swoole is not installed.
    enhancement 
    opened by acelaya 0
Releases(v8.2.0)
  • v8.2.0(Sep 18, 2022)

    Changed

    • Nothing

    Added

    • Added config option to enable/disable trailing slashes support.
    • Added new script to make sure first API key is generated after successfully installing Shlink.

    Removed

    • Nothing

    Fixed

    • Nothing

    Deprecated

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v8.1.0(Aug 8, 2022)

  • v8.0.0(Aug 4, 2022)

    Changed

    • Nothing

    Added

    • #162 Added support for the redis pub/sub config option.
    • #166 Added support for the multi-segment slugs config option.

    Removed

    • #161 Dropped support for PHP 8.0
    • #151 Removed compatibility with config path approach. Only env vars are supported now.

    Fixed

    • Nothing

    Deprecated

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v7.1.0(Apr 23, 2022)

    Added

    • #157 Added support for the timezone config option.

    Changed

    • Nothing

    Changed

    • Nothing

    Removed

    • Nothing

    Fixed

    • #155 Fixed router config cache not getting deleted when editing config options.

    Deprecated

    • Deprecated webhook-related config options.
    Source code(tar.gz)
    Source code(zip)
  • v7.0.2(Feb 19, 2022)

  • v7.0.1(Feb 9, 2022)

    Added

    • Nothing

    Changed

    • Nothing

    Changed

    • Nothing

    Removed

    • Nothing

    Fixed

    • Fixed non-sqlite questions being asked when importing a pre-7.0 config using SQLite.

    Deprecated

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v7.0.0(Jan 27, 2022)

    Added

    • #143 Reworked how config options are "persisted", switching from regular config to an env var map.

    Changed

    • Nothing

    Changed

    • Dropped support for Symfony 5.
    • Updated to infection 0.26, enabling HTML reports.
    • Added explicitly enabled composer plugins to composer.json.

    Removed

    • Removed everything that was deprecated

    Fixed

    • Nothing

    Deprecated

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v6.3.0(Dec 12, 2021)

    Added

    • #140 Added support for RabbitMQ options.
    • Added support for PHP 8.1.
    • Added support for Symfony 6.0.
    • Added support for openswoole.
    • Added "round block size" config option for QR codes.

    Changed

    • Nothing

    Changed

    • Updated to phpstan 1.0

    Removed

    • Nothing

    Fixed

    • Nothing

    Deprecated

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v6.2.1(Oct 23, 2021)

  • v6.2.0(Oct 10, 2021)

    Added

    • #122 Added support for QR code config options.
    • #124 Added support for redis sentinels in redis config.
    • #126 Added support to send orphan visits to webhooks, if any.
    • #128 Added support for IP-based tracking.

    Changed

    • Nothing

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v6.1.0(Aug 4, 2021)

    Added

    • #115 Added support for append_extra_path config option.

    Changed

    • #117 Added experimental builds under PHP 8.1
    • #120 Increased required PHPStan level to 8.

    Deprecated

    • Nothing

    Removed

    • #118 Dropped support for PHP 7.4

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v6.0.0(May 22, 2021)

    Added

    • #86 Added new optional installation command to download GeoLite2 db file.
    • #109 Added ability to define deprecated config paths for options, that are transparently migrated to the new one during update.
    • #108 Added new tracking options.

    Changed

    • #106 Increased required mutation score to 90%.
    • #112 Ensured IP anonymization option is only asked if tracking or IP tracking have not been disabled.

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v5.4.0(Feb 13, 2021)

    Added

    • #101 Added new "auto generate titles" option.
    • #103 Added "track orphan visits" option.

    Changed

    • Migrated build to Github Actions.

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v5.3.0(Dec 11, 2020)

    Added

    • #51 Created new command that allows updating the value of any configuration option.

    Changed

    • #96 Updated required MSI to 85%.

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v5.2.0(Nov 29, 2020)

    Added

    • Added explicit support for PHP 8
    • Added support for unix sockets on MySQL, MariaDB and PostgreSQL databases

    Changed

    • Updated to infection 0.20.

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v5.1.0(Jun 20, 2020)

  • v5.0.0(May 9, 2020)

    Added

    • #71 Added config options for mercure integration.
    • #82 Added config option to optionally disable IP address anonymization.
    • #76 Added MYSQL_ATTR_USE_BUFFERED_QUERY => true driver option for mysql and mariadb connections.

    Changed

    • #74 Grouped several config options to sub-namespaces. The changed classes are as follows.

      • Database:
        • Config\Option\DatabaseDriverConfigOption -> Config\Option\Database\DatabaseDriverConfigOption
        • Config\Option\DatabaseNameConfigOption -> Config\Option\Database\DatabaseNameConfigOption
        • Config\Option\DatabaseHostConfigOption -> Config\Option\Database\DatabaseHostConfigOption
        • Config\Option\DatabasePortConfigOption -> Config\Option\Database\DatabasePortConfigOption
        • Config\Option\DatabaseUserConfigOption -> Config\Option\Database\DatabaseUserConfigOption
        • Config\Option\DatabasePasswordConfigOption -> Config\Option\Database\DatabasePasswordConfigOption
        • Config\Option\DatabaseSqlitePathConfigOption -> Config\Option\Database\DatabaseSqlitePathConfigOption
        • Config\Option\DatabaseMySqlOptionsConfigOption -> Config\Option\Database\DatabaseMySqlOptionsConfigOption
      • UrlShortener:
        • Config\Option\ShortDomainHostConfigOption -> Config\Option\UrlShortener\ShortDomainHostConfigOption
        • Config\Option\ShortDomainSchemaConfigOption -> Config\Option\UrlShortener\ShortDomainSchemaConfigOption
        • Config\Option\ValidateUrlConfigOption -> Config\Option\UrlShortener\ValidateUrlConfigOption
        • Config\Option\ShortCodeLengthOption -> Config\Option\UrlShortener\ShortCodeLengthOption
      • Visit:
        • Config\Option\VisitsWebhooksConfigOption -> Config\Option\Visit\VisitsWebhooksConfigOption
        • Config\Option\CheckVisitsThresholdConfigOption -> Config\Option\Visit\CheckVisitsThresholdConfigOption
        • Config\Option\VisitsThresholdConfigOption -> Config\Option\Visit\VisitsThresholdConfigOption
      • Redirect:
        • Config\Option\BaseUrlRedirectConfigOption -> Config\Option\Redirect\BaseUrlRedirectConfigOption
        • Config\Option\InvalidShortUrlRedirectConfigOption -> Config\Option\Redirect\InvalidShortUrlRedirectConfigOption
        • Config\Option\Regular404RedirectConfigOption -> Config\Option\Redirect\Regular404RedirectConfigOption
      • Worker:
        • Config\Option\TaskWorkerNumConfigOption -> Config\Option\Worker\TaskWorkerNumConfigOption
        • Config\Option\WebWorkerNumConfigOption -> Config\Option\Worker\WebWorkerNumConfigOption

      The rest remain the same.

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • #78 Allowed clear cache command to fail, and ensured it is not run on new installs.
    Source code(tar.gz)
    Source code(zip)
  • v4.4.0(Apr 29, 2020)

  • v4.3.2(Apr 6, 2020)

    Added

    • Nothing

    Changed

    • #68 Updated dev dependencies.

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • #69 Ensured doctrine orm:clear-cache:meta command is run after the installation, to avoid outdated cached metadata to be persisted between versions.
    Source code(tar.gz)
    Source code(zip)
  • v4.3.1(Mar 23, 2020)

  • v4.3.0(Mar 13, 2020)

    Added

    • Nothing

    Changed

    • #64 Added shlinkio/shlink-config as a project dependency, deprecating the Shlinkio\Shlink\Installer\Utils\PathCollection class.

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v4.2.0(Feb 18, 2020)

  • v4.1.0(Feb 15, 2020)

    Added

    • #56 Added MicrosoftSQL to the list of supported database servers.
    • #57 Created new service to handle importing assets from previous versions when updating.

    Changed

    • Nothing

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v4.0.1(Jan 27, 2020)

    Added

    • #41 Added gif to readme file which shows how the tool works.

    Changed

    • Nothing

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • #55 Fixed GeoLite db file not being imported on updates.
    Source code(tar.gz)
    Source code(zip)
  • v4.0.0(Jan 5, 2020)

    Added

    • #19 Added support to ask for redis servers URIs during installation.

    Changed

    • #38 Configuration generation deeply refactoring, easing including new options.
    • #44 Updated to coding standard v2.1.0
    • #45 Migrated from Zend Framework components to Laminas.

    Deprecated

    • Nothing

    Removed

    • #43 Dropped support for PHP 7.2 and 7.3
    • #52 GeoLite2 db is no longer downloaded during installation.

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v3.3.0(Dec 29, 2019)

  • v3.2.0(Nov 30, 2019)

    Added

    • Nothing

    Changed

    • Updated dependencies and no longer allow build failures on PHP 7.4

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Nov 30, 2019)

    Added

    • #30 Added support to ask for the amount of web workers and task workers that should be used when serving the app with swoole.

    Changed

    • Nothing

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Nov 2, 2019)

    Added

    • #31 Added new configuration options for URL redirects.

    Changed

    • #28 Updated coding-standard and infection dependencies.

    Deprecated

    • Nothing

    Removed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Oct 6, 2019)

Owner
Shlink. The self-hosted URL shortener
null
PHP Interminal is a command-line tool that gives you access to PHP Internals discussions in your terminal.

PHP Interminal is a command-line tool that gives you access to PHP Internals discussions in your terminal. ??

Nuno Maduro 32 Dec 26, 2022
Patrol is an elegant command-line tool that keeps your PHP Project's dependencies in check.

Patrol is an elegant command-line tool that keeps your PHP Project's dependencies in check. Installation / Usage Requires PHP 8.0+ First, install Patr

Nuno Maduro 237 Nov 14, 2022
A simple command-line tool whose aim is to facilitate the continous delivery of PHP apps

Deployer Simple command-line tool that aims to facilitate the continous delivery of PHP apps, particularly Laravel apps. Imagine you want to update yo

Fernando Bevilacqua 4 Sep 8, 2021
A PHP Command Line tool that makes it easy to compile, concat, and minify front-end Javascript and CSS/SCSS dependencies.

Front End Compiler A PHP Command Line tool that makes it easy to compile, concat, and minify front-end Javascript and CSS/SCSS dependencies. The minif

Happy Medium 2 Nov 12, 2021
👨🏻‍🚀 A command-line tool that gives you the Alpine Day 2021 schedule in your timezone. 🚀

Alpine Day Schedule a command-line tool that gives you the Alpine Day 2021 schedule in your timezone. ?? Quick start Requires PHP 7.4+ # First, instal

Nuno Maduro 11 Jun 10, 2021
Laracon Schedule a command-line tool that gives you the Laracon Online schedule in your timezone.

Laracon Schedule a command-line tool that gives you the Laracon Online schedule in your timezone. ?? Quick start Requires PHP 7.4+ # First, install: c

Nuno Maduro 101 Sep 16, 2022
Simple command-line tool to access HiWeb account information

Simple command-line tool to access HiWeb account information.

Milad Nekofar 2 Dec 26, 2022
💥 Collision is a beautiful error reporting tool for command-line applications

Collision was created by, and is maintained by Nuno Maduro, and is a package designed to give you beautiful error reporting when interacting with your

Nuno Maduro 4.2k Jan 5, 2023
Lovely PHP wrapper for using the command-line

ShellWrap What is it? It's a beautiful way to use powerful Linux/Unix tools in PHP. Easily and logically pipe commands together, capture errors as PHP

James Hall 745 Dec 30, 2022
A PHP library for command-line argument processing

GetOpt.PHP GetOpt.PHP is a library for command-line argument processing. It supports PHP version 5.4 and above. Releases For an overview of the releas

null 324 Dec 8, 2022