devdot / cli-directory-project
Addon for making directory projects, suitable for devdot/cli.
v1.1.0
2025-09-29 16:07 UTC
Requires
- php: ^8.3
- devdot/cli: ^1
- symfony/filesystem: ^7
Requires (Dev)
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^11.3
- squizlabs/php_codesniffer: ^3.10
This package is auto-updated.
Last update: 2025-09-29 16:08:22 UTC
README
Tools for development of devdot/cli.
See documentation on https://github.com/devdot/cli.
Use with traits like this (will add the --working-dir option flag to a command):
use Devdot\Cli\Command as CliCommand; use Devdot\Cli\DirectoryProject\WorkingDirectoryTrait; class Command extends CliCommand { use WorkingDirectoryTrait; public function __construct() { parent::__construct(); } protected function handle(): int { $this->output->writeln($this->getWorkingDirectory()); $cwd = $this->getWorkingDirectoryInterface(); $this->output->writeln($cwd->formatPath('somewhere/relative')); return self::SUCCESS; } }
Add to the CLI Kernel services if you want to get WorkingDirectoryInterface
as a dependency injection available object at Command
construction:
// src/Kernel.php final class Kernel extends BaseKernel { // ... protected array $providers = [ \Devdot\Cli\DirectoryProject\WorkingDirectoryServiceProvider::class, // .. ]; // .. }