Skip to content

Commit

Permalink
Add PackageInstaller
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyTapok-bit committed Apr 15, 2024
1 parent 0b72fcf commit a0df092
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
],
"scripts": {
"test": "phpunit --colors=always",
"analyze": "phpstan analyze --ansi"
"analyze": "phpstan analyze --ansi",
"post-package-install": "TgWebValid\\PackageInstaller::postPackageInstall",
"post-package-uninstall": "TgWebValid\\PackageInstaller::postPackageUninstall"
},
"require": {
"php": "^8.2",
Expand Down
57 changes: 57 additions & 0 deletions src/PackageInstaller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

namespace TgWebValid;

class PackageInstaller
{
private const BOLD = "\e[1m";
private const RESET = "\e[0m";
private const BLUE = "\e[34m";

private const GITHUB = '~/ GitHub: https://github.com/CrazyTapok-bit/tgWebValid';
private const WEBSITE = '~/ Website: https://tgwebvalid.com/en';
private const PATREON = '~/ Patreon: https://patreon.com/user?u=99188087';

public static function postPackageInstall(): void
{
self::logo();

self::row('They say we are cool 😎');
self::row('⭐️ Support us, give us a star on GitHub and become our sponsor 😊');
echo PHP_EOL;

self::row(self::WEBSITE, self::BLUE);
self::row(self::GITHUB, self::BLUE);
self::row(self::PATREON, self::BLUE);
}

public static function postPackageUninstall(): void
{
self::logo();

self::row('We are very sorry 😔');
self::row('Please tell us on GitHub what exactly didn\'t work for you?');
echo PHP_EOL;

self::row(self::GITHUB, self::BLUE);
self::row(self::WEBSITE, self::BLUE);
}

private static function logo(): void
{
echo PHP_EOL;
self::row('████████╗ ██████╗ ██╗ ██╗███████╗██████╗ ██╗ ██╗ █████╗ ██╗ ██╗██████╗ ', self::BLUE, true);
self::row('╚══██╔══╝██╔════╝ ██║ ██╗ ██║██╔════╝██╔══██╗ ██║ ██║██╔══██╗██║ ██║██╔══██╗', self::BLUE, true);
self::row(' ██║ ██║ ██╗ ╚██╗████╗██╔╝█████╗ ██████╦╝ ╚██╗ ██╔╝███████║██║ ██║██║ ██║', self::BLUE, true);
self::row(' ██║ ██║ ╚██╗ ████╔═████║ ██╔══╝ ██╔══██╗ ╚████╔╝ ██╔══██║██║ ██║██║ ██║║', self::BLUE, true);
self::row(' ██║ ╚██████╔╝ ╚██╔╝ ╚██╔╝ ███████╗██████╦╝ ╚██╔╝ ██║ ██║███████╗██║██████╔╝║', self::BLUE, true);
self::row(' ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝╚═════╝ ', self::BLUE, true);
echo PHP_EOL;
}

private static function row(string $text, ?string $color = null, bool $bold = false): void
{
$bold = $bold ? self::BOLD : "";
echo $bold . $color . $text . self::RESET . PHP_EOL;
}
}

0 comments on commit a0df092

Please sign in to comment.