Alternative installation methods - nelson6e65/php_nml GitHub Wiki
Alternatives to Composer installation
Note: Is highly recommended to use Composer to install and update this PHP package instead.
If you don't want to use Composer (or you are not able to), you can follow this instructions to install this package into your vendor directory as nelson6e65/php_nml.
Before installing
This instructions assumes that your current directory is your project root directory. Use cd command as you need. Ejample:
cd /var/www/html/my-awesome-php-project
Also, if not already created, create your vendor directory:
mkdir vendor
Installing
Via git submodule
Note: Git is required.
git submodule add https://github.com/nelson6e65/php_nml.git vendor/nelson6e65/php_nml
git submodule init
git submodule update
Finally, install dependencies manually (see below).
Read more about Git submodules here.
Manually
- Download the latest release.
- Unzip that download.
- Rename the resulting folder to
php_nml. - Then move this folder into your
vendor/nelson6e65directory. - Install dependencies manually (see below).
Install dependencies
Instructions are similar to this. You must follow the specific instructions for Cake Utility in https://github.com/cakephp/utility and install latest release (3.0.x).
For consistence, you should use your
vendor/cakephp/utilitydirectory to install it.
After install, you must to load Cake\Utility\Text class, including Text.php directly or register an autoloader for that classes.
This is an autoloader example for Cake\Utility namespace (if installed in your vendor directory as cakephp/utility).
<?php
// File: vendor/autoload_nml_dependencies.php
// Cake\Utility location: vendor/cakephp/utility
function autoload_nml_dependencies($class)
{
static $DS = DIRECTORY_SEPARATOR;
if ($class[0] == '\\') {
$class = substr($class, 1);
}
$classArray = explode('\\', $class);
if ($classArray[0] == 'Cake') {
$classArray[0] = 'cakephp';
if ($classArray[1] == 'Utility') {
$classArray[1] = 'utility';
} else {
// Is not a 'Cake\Utility' namespace.
return;
}
} else {
// Is not a 'Cake' namespace.
return;
}
$path = sprintf('%s'.$DS.'%s.php', __DIR__, implode($DS, $classArray));
if (is_file($path)) {
require_once($path);
} else {
// throw new InvalidArgumentException("Error loading '$class' class. File '$path' is not present.");
}
}
spl_autoload_register('autoload_nml_dependencies');
?>