PHP code example of wemakecustom / composer-script-utils
1. Go to this page and download the library: Download wemakecustom/composer-script-utils library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wemakecustom / composer-script-utils example snippets
use Composer\Script\Event;
use WMC\Composer\Utils\Composer\PackageLocator;
class ScriptHandler
{
public static function myHandler(Event $event)
{
$directory = PackageLocator::getPackagePath($event->getComposer(), 'composer/composer');
}
}
use WMC\Composer\Utils\Filesystem\PathUtil;
$relPath = PathUtil::getRelativePath('/tmp/foo/bar', '/tmp/baz'); // ../foo/bar
// dist/foo.ini.php
return array('foo' => 'bar');
use Composer\Script\Event;
use WMC\Composer\Utils\ScriptHandler as Base;
class ScriptHandler
{
public static function myHandler(Event $event)
{
$configFile = Base::createConfigFileUpdate($event->getIO());
$configFile->updateFile('database.ini', 'database.ini.dist');
}
}
ini
; database.dist.ini
user=root
pass=root
name=my_database
host=localhost
ini
; local/foo.ini
foo=bar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.