PHP code example of civicrm / composer-compile-lib
1. Go to this page and download the library: Download civicrm/composer-compile-lib 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/ */
civicrm / composer-compile-lib example snippets
\CCL::assertTask();
$files = \CCL::globMap('scss/*.scss', 'dist/#1.css', 1);
\CCL\Tasks::scss([
'scss-files' => $files,
'scss-imports' => ['scss']
'scss-import-prefixes' => ['LOGICAL_PREFIX/' => 'physical/folder/']
]);
$files = \CCL::globMap('src/Entity/*.json', 'src/Entity/#1.php', 1);
\CCL\Tasks::template([
"tpl-file" => "src/Entity/EntityTemplate.php",
"tpl-items" => $files,
]);
// PHP Standard Library
if (!copy('old', 'new')) {
throw new \Exception("...");
}
// Symfony Filesystem
$fs = new \Symfony\Component\Filesystem\Filesystem();
$fs->copy('old', 'new');
// Composer Compile Library
\CCL::copy('old', 'new');
// CCL wrapper functions
function chdir(string $dir);
function glob($pat, $flags = null);
// CCL distinct functions
function cat($files);
function mapkv($array, $func);
function globMap($globPat, $mapPat, $flip = false);
// Symfony wrapper functions
function appendToFile($filename, $content);
function dumpFile($filename, $content);
function mkdir($dirs, $mode = 511);
function touch($files, $time = null, $atime = null);
function copy($originFile, $targetFile, $overwriteNewerFiles = true);
function mirror($originDir, $targetDir, $iterator = null, $options = []);
function remove($files);
function rename($origin, $target, $overwrite = false);
function chgrp($files, $group, $recursive = false);
function chmod($files, $mode, $umask = 0, $recursive = false);
function chown($files, $user, $recursive = false);
function hardlink($originFile, $targetFiles);
function readlink($path, $canonicalize = false);
function symlink($originDir, $targetDir, $copyOnWindows = false);
function exists($files);
function tempnam($dir, $prefix);
javascript
{
"extra": {
"compile": [
{
"title": "Sandwich (<comment>src/Sandwich.php</comment>)",
"run": "@php-method \\CCL\\Tasks::template",
"watch-files": ["src/Entity"],
"tpl-items": [
"src/Entity/Sandwich.php": "src/Entity/Sandwich.json",
"src/Entity/Salad.php": "src/Entity/Salad.json"
],
"tpl-file": "src/Entity/EntityTemplate.php"
}
]
}
}