codersalman / include-with-variables
A library that includes a file with variables
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/codersalman/include-with-variables
Requires
- php: >=5.6
README
This is a PHP library that allows you to include a file with variables. It is compatible with PHP versions 5.6 and above.
Installation
You can install this package via Composer:
composer require codersalman/include-with-variables
Usage
To use this library, you need to call the includeWithVariables function with the file path and the variables you want to include. Here is an example:
$variables = ['var1' => 'value1', 'var2' => 'value2']; $content = includeWithVariables('path/to/your/file.php', $variables);
In this example, path/to/your/file.php is the path to the file you want to include, and $variables is an associative array of the variables you want to include in the file. The function will return the content of the file as a string.
If you want to include a file without any variables, you can simply call the include function:
$content = includeWithVariables('path/to/your/file.php');
License
This library is open-sourced software licensed under the MIT license.