PHP code example of shineunited / conductor-twig-addon
1. Go to this page and download the library: Download shineunited/conductor-twig-addon 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/ */
shineunited / conductor-twig-addon example snippets
namespace Example\Project;
use Composer\Composer;
use Composer\IO\IOInterface;
use ShineUnited\Conductor\Addon\Twig\Capability\NamespaceProvider;
use ShineUnited\Conductor\Capability\BlueprintProvider;
class ComposerPlugin implements PluginInterface, Capable {
public function activate(Composer $composer, IOInterface $io): void {
// ...
}
public function deactivate(Composer $composer, IOInterface $io): void {
// ...
}
public function uninstall(Composer $composer, IOInterface $io): void {
// ...
}
public function getCapabilities(): array {
return [
NamespaceProvider::class => ExampleNamespaceProvider::class,
BlueprintProvider::class => ExampleBlueprintProvider::class
];
}
}
namespace Example\Project;
use ShineUnited\Conductor\Addon\Twig\Capability\NamespaceProvider;
use ShineUnited\Conductor\Addon\Twig\Loader\TwigNamespace;
class ExampleNamespaceProvider implements NamespaceProvider {
public function getNamespaces(): array {
return [
new TwigNamespace('path/to/template/dir', 'optional-namespace'),
new TwigNamespace('path/to/global/templates') // load in root namespace
];
}
}
namespace Example\Project;
use ShineUnited\Conductor\Capability\BlueprintProvider;
use ShineUnited\Conductor\Addon\Twig\Blueprint\TwigBlueprint;
class ExampleBlueprintProvider implements BlueprintProvider {
public function getBlueprints(): array {
return [
new TwigBlueprint('path/to/file.html', '@namespace/template.twig'),
new TwigBlueprint('another/file.html', 'global.twig')
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.