setono/variable-resolver

Replace variables in strings with real values

Maintainers

Package info

github.com/Setono/variable-resolver

pkg:composer/setono/variable-resolver

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 1

dev-master / 1.0.x-dev 2020-05-25 12:06 UTC

This package is auto-updated.

Last update: 2026-03-15 08:10:54 UTC


README

Latest Version Latest Unstable Version Software License Build Status Coverage Status Quality Score

This is a library that replaces variables like %PHP% or %APP_ENV% with their real values. This is typically used for deployment purposes.

Installation

$ composer require setono/variable-resolver

Basic usage

use Setono\VariableResolver\VariableResolver;
use Setono\VariableResolver\Parser\PercentageWrappingParser;
use Setono\VariableResolver\Variable\Value\PhpBinValue;

$str = '%PHP% bin/console run:command';

$variableResolver = new VariableResolver(new PercentageWrappingParser());
$variableResolver->addValue('PHP', new PhpBinValue());

echo $variableResolver->resolve($str); // output: /usr/bin/php bin/console run:command