PEAR_PackageFileManager::addReplacement() – Add a replacement option for a file


require_once 'PEAR/PackageFileManager.php';

void PEAR_PackageFileManager::addReplacement ( string $path , string $type , string $from , string $to )


This sets an install-time complex search-and-replace function allowing the setting of platform-specific variables in an installed file.

if $type is php-const, then $to must be the name of a PHP Constant. If $type is pear-config, then $to must be the name of a PEAR config variable accessible through a PEAR_Config::get() method. If type is package-info, then $to must be the name of a section from the package.xml file used to install this file.


string $path

relative path of file (relative to packagedirectory option)

string $type

variable type, either php-const, pear-config or package-info

string $from

text to replace in the source file

string $to

variable name to use for replacement




This function can not be called statically.

Add a replacement option for all files (Previous) Add an extension/role mapping to the role mapping option (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.