welsh-tidy-mouse/binary-providers

dev-main 2025-05-27 20:19 UTC

This package is auto-updated.

Last update: 2025-05-28 14:54:11 UTC


README

Binaries Tests PHP Tests Binary Fetcher license

This repository provides a set of binary providers for use with the Binary Fetcher library.

Each binary provider defines how to locate and download a specific binary from GitHub releases, tailored to the current platform (OS + architecture). These providers are used by Binary Fetcher to automate the installation of CLI tools across environments.

๐Ÿ“ฆ What Is This For?

The binary-fetcher project is a PHP-based tool to download platform-specific binaries with zero configuration. It can be used both:

  • Via CLI (bin/binary-fetcher download)
  • Via PHP (BinaryFetcher::download())

This repository (binary-providers) contains the list of supported binaries through reusable PHP provider classes.

๐Ÿงฉ Available Binary Providers

Provider Class Binary Source URL Notes
\WelshTidyMouse\BinaryProvider\BunJsBinaryProvider bun oven-sh/bun JavaScript runtime (Node.js alternative)
\WelshTidyMouse\BinaryProvider\TailwindCssBinaryProvider tailwindcss tailwindlabs/tailwindcss CSS utility framework CLI
\WelshTidyMouse\BinaryProvider\SassBinaryProvider dart-sass sass/dart-sass Sass compiler (standalone executable)

๐Ÿ”ง Install

composer require welsh-tidy-mouse/binary-fetcher

๐Ÿš€ How to Use These Providers

Using Binary Fetcher, you can download any of these binaries based on your current OS and architecture.

From CLI

bin/binary-fetcher download "\WelshTidyMouse\BinaryProvider\BunJsBinaryProvider"

From PHP

use WelshTidyMouse\BinaryFetcher\BinaryFetcher;
use WelshTidyMouse\BinaryProvider\BunJsBinaryProvider;

$binaryPath = (new BinaryFetcher())->download(BunJsBinaryProvider::class);

The binary will be downloaded to a writable location and its path will be returned.

๐Ÿ› ๏ธ Development & Contributions

You can add your own binary provider class implementing the interface:

namespace WelshTidyMouse\BinaryFetcher\Contract;

use WelshTidyMouse\BinaryFetcher\Exception\BinaryProviderException;
use WelshTidyMouse\BinaryFetcher\Type\OsType;
use WelshTidyMouse\BinaryFetcher\Type\SystemArchType;

interface BinaryProviderInterface
{
    public function __construct();
    public function getName(): string;
    public function getDownloadableAssetUrl(string $version, OsType $os, SystemArchType $arch): ?string;
    public function getBinaryFilenameFromDownloadedAsset(string $assetFileName, string $downloadDirPath): string;
}

Pull requests for additional binary providers are welcome!

๐Ÿงช Quality

  • composer lint to run PHPStan
  • composer cs to fix files with Code Sniffer
  • composer mdto run PHPMD
  • composer check for all commands above

๐Ÿ Part of Welsh Tidy Mouse

This package is part of the Welsh Tidy Mouse ecosystem. Read more on the main repository: binary-fetcher