1. Go to this page and download the library: Download psbits/crafter 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/ */
psbits / crafter example snippets
#[AsEventListener(identifier: 'my_extension/crafterConfiguration')]
public function __invoke(ModifyConfigurationEvent $event): void
{
if (str_starts_with((string)$event->getExtensionKey(), 'client_')) {
$event->addOverrides(['defaults' => ['copyrightHolder' => 'Client Ltd.']]);
}
}
#[AsEventListener(identifier: 'my_extension/crafterFormat')]
public function __invoke(AfterGenerationEvent $event): void
{
if (true === $event->isDryRun()) {
return;
}
foreach ($event->getChangedPaths() as $path) {
// run a formatter, add the file to the index, ...
}
}