PHP code example of proximify / cli-actions
1. Go to this page and download the library: Download proximify/cli-actions 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/ */
proximify / cli-actions example snippets
namespace XYZ;
class PublisherCLI extends \Proximify\CLIActions
{
static public function getActionFolder(): string
{
// E.g. own settings folder, one level up from __DIR__
return dirname(__DIR__) . '/settings/cli';
}
}
public function someActionCallback(array $options, array $env)
{
// Note: 'event' exits only for Composer-triggered actions
$event = $env['event'];
// Get the Composer app object
$composer = $event->getComposer();
// Get the path to the project's vendor folder
$vendorDir = $composer->getConfig()->get('vendor-dir');
// Get the "extra" property of the composer.json
$extra = $composer->getPackage()->getExtra();
// Get the package being installed or updated
$installedPackage = $event->getOperation()->getPackage();
// Output a message to the console
$event->getIO()->write("Some message");
}