PHP code example of vortos / vortos-ops-kit
1. Go to this page and download the library: Download vortos/vortos-ops-kit 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/ */
vortos / vortos-ops-kit example snippets
// 1. A port that extends DriverInterface
interface DeployTargetInterface extends DriverInterface { /* ... */ }
// 2. A typed registry
final class DeployTargetRegistry extends TaggedDriverRegistry {
public function __construct(ContainerInterface $drivers) { parent::__construct('deploy', $drivers); }
public function target(string $key): DeployTargetInterface { return $this->get($key); }
}
// 3. A collecting pass
final class CollectDeployTargetsPass extends CollectDriversCompilerPass {
public function __construct() { parent::__construct('vortos.deploy.target', 'vortos.deploy.target_locator', 'deploy'); }
}
// 4. In the concern's DI extension:
// - register the ServiceLocator (tag container.service_locator) + the registry
// - registerForAutoconfiguration(DeployTargetInterface::class)->addTag('vortos.deploy.target')
// - in Package::build(): CollectDriversCompilerPass::register($container, new CollectDeployTargetsPass())
// 5. A conformance TCK base for the port (extends ConformanceTestCase), and an
// agnosticism test (extends AgnosticismLintTestCase).