1. Go to this page and download the library: Download laravilt/plugins 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/ */
namespace App\PluginFeatures;
use Laravilt\Plugins\Features\AbstractFeature;
class CustomFeature extends AbstractFeature
{
public function getName(): string
{
return 'custom';
}
public function shouldGenerate(array $config): bool
{
return $config['generate_custom'] ?? false;
}
public function getPriority(): int
{
return 99; // Execute near the end
}
public function generate(array $config): void
{
// Your generation logic
$this->processor->generateFile(
$config['base_path'].'/custom/file.php',
'custom/file',
['key' => 'value']
);
}
}
'features' => [
// ... existing features
\App\PluginFeatures\CustomFeature::class,
],