Skip to content

Binary wrapper that makes your programs seamlessly available as local dependencies

License

Notifications You must be signed in to change notification settings

itgalaxy/bin-wrapper

Repository files navigation

bin-wrapper

Latest Stable Version Travis Build Status Build status

Binary wrapper that makes your programs seamlessly available as local dependencies

Install

The utility can be installed with Composer:

$ composer require bin-wrapper

Usage

<?php
use Itgalaxy\BinWrapper\BinWrapper;

$url = 'https://github.com/itgalaxy/pngquant-bin/raw/master/bin-vendor';
$platform = strtolower(PHP_OS);
$binWrapper = new BinWrapper();
$binWrapper
    ->src($url . '/freebsd/x64/pngquant', 'darwin', 'x64')
    ->src($url . '/linux/x64/pngquant', 'linux', 'x64')
    ->src($url . '/linux/x86/pngquant', 'linux', 'x86')
    ->src($url . '/macos/pngquant', 'darwin')
    ->src($url . '/win/pngquant.exe', 'windowsnt')
    ->dest(__DIR__ . '/vendor-bin')
    ->using(substr($platform, 0, 3) === 'win' ? 'pngquant.exe' : 'pngquant')
    ->version('>=1.71');

$binWrapper->run(['--version']); // You can use `try {} catch {}` for catching exceptions

Get the path to your binary with $binWrapper->path():

<?php
echo $binWrapper->path();

API

Coming soon

Related

Contribution

Feel free to push your code if you agree with publishing under the MIT license.

About

Binary wrapper that makes your programs seamlessly available as local dependencies

Resources

License

Stars

Watchers

Forks

Packages

No packages published