gk / phpstorm-configurator
Configure PHPStorm project (including Symfony2 plugin)
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 2
Open Issues: 1
Type:application
Requires
- php: >=5.4.0
- symfony/console: ~2.6
- symfony/finder: ~2.6
This package is not auto-updated.
Last update: 2025-04-26 19:29:18 UTC
README
A tool to help configuring phpstorm projects (add excluded folders, enable symfony2 plugin, etc.)
Installation (globally, using composer)
$ composer global require gk/phpstorm-configurator:dev-master
make sure you have ~/.composer/vendor/bin
in your PATH
export PATH="$PATH:$HOME/.composer/vendor/bin"
CLI Usage
phpstorm-configurator configure
Configures the currently working directory as a PHPStorm project. (The simple usage is useless, you'd better use pstorm .
)
Exclude folders
phpstorm-configurator configure --exclude app/cache -exclude app/logs
or, using the shorthand options
phpstorm-configurator configure -x app/cache -x app/logs
Symfony2 plugin
phpstorm-configurator configure --plugin symfony2
or, using the shorthand options
phpstorm-configurator configure -p symfony2
This marks app/cache
and app/logs
as excluded and enables the Symfony2 plugin
Code usage
If you want to finetune the configuration of the project:
#!/usr/bin/env php <?php require_once $_SERVER['HOME'] . "/.composer/vendor/autoload.php"; $projectDir = getcwd(); $configurator = new \Gk\PHPStormConfigurator\ProjectConfigurator($projectDir); /** * Exclude some folders */ $imlPlugin = $configurator->getPlugin('iml'); $imlPlugin ->addExcludeFolder('app/cache') ->addExcludeFolder('app/logs') ; /** * Configure the Symfony2 plugin (http://symfony2-plugin.espend.de/). * This also excludes the app/cache and app/logs directories */ $symfony2Plugin = $configurator->getPlugin('symfony2'); $symfony2Plugin ->addOption("directoryToApp", "app") ->addOption("pathToUrlGenerator", "app/cache/dev/adminDevUrlGenerator.php") ->addOption("pathToTranslation", "app/cache/dev/translations") ->addContainerFile("app/cache/dev/adminDevDebugProjectContainer.xml") ; /** * Add some files/directories to the default favorite list. * The directories must be traversed recursively, for each child PHPStorm requires an entry in workspace.xml * Adding directories with a large number of children can slow down your script. */ $workspacePlugin = $configurator->getPlugin('workspace'); $workspacePlugin ->addToFavorites($projectDir . '/dir1') ->addToFavorites($projectDir . '/file2') ; $configurator->writeConfig();