2017 © Pedro Peláez
 

application phpstorm-configurator

Configure PHPStorm project (including Symfony2 plugin)

image

gk/phpstorm-configurator

Configure PHPStorm project (including Symfony2 plugin)

  • Thursday, November 9, 2017
  • by geecu
  • Repository
  • 1 Watchers
  • 2 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

phpstorm-configurator

A tool to help configuring phpstorm projects (add excluded folders, enable symfony2 plugin, etc.), (*1)

Installation (globally, using composer)

$ composer global require gk/phpstorm-configurator:dev-master

make sure you have ~/.composer/vendor/bin in your PATH, (*2)

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 .), (*3)

Exclude folders

phpstorm-configurator configure --exclude app/cache -exclude app/logs

or, using the shorthand options, (*4)

phpstorm-configurator configure -x app/cache -x app/logs

Symfony2 plugin

phpstorm-configurator configure --plugin symfony2

or, using the shorthand options, (*5)

phpstorm-configurator configure -p symfony2

This marks app/cache and app/logs as excluded and enables the Symfony2 plugin, (*6)

Code usage

If you want to finetune the configuration of the project:, (*7)

#!/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();

The Versions

09/11 2017

dev-master

9999999-dev

Configure PHPStorm project (including Symfony2 plugin)

  Sources   Download

MIT

The Requires

 

by Gunther Konig

symfony2 phpstorm configurator