A tool to launch the closest app/console available from anywhere in the hierarchy of a symfony2 project.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Symfony2 Console Autolookup

Table of contents

  1. Description
  2. Installation
  3. Usage
  4. Contributing
  5. Authors
  6. License


The idea of this little snippet is to be able to run the Symfony2 console from anywhere in the directory tree, without the need to move on the right folder.

It is similar to git at use as it can be ran from any of the subfolder.


Just clone the repository and move the file into ~/bin (make sure it is in your $PATH)

$ git clone git://github.com/borisguery/sf2console-autolookup.git && cd sf2console-autolookup
$ mv sc ~/bin/
$ chmod +x ~/bin/sc

Or for system-wide usage:

$ mv sc /usr/local/bin/
$ chmod +x ~/bin/sc


Let's say you're currently in sf2projectroot/app/cache/twig for some debugging purpose

$ sc twig:lint somefile

It will run sf2projectroot/app/console

If you move into another project, you can re-run the same command and the according console will be run.


This tip is not only applicable to this script but most of the little tools you may find.

Make a bin/ directory into your home (may it be /home/username or /Users/username)

$ mkdir ~/bin

Then add it to your $PATH env variable, in your .bash_profile (or whatever it may be)



It is possible to autocomplete your command according to the path found by the script. It means that the result of the completion will vary depending on your path.

To enable it, move the sc.complete into your completion directory. It should be either /etc/bash_completion.d or /opt/local/etc/bash_completion.d.

Make sure to source /etc/bash_completion.d/sf2console.complete the moved file to load the autocompletion.

Note that it is currently a bit slow, because the path needs to be computed on each call


If you have some time to spare on an useless project and would like to help take a look at the list of issues.


Boris Guéry - guery.b@gmail.com - http://twitter.com/borisguery - http://borisguery.com


Symfony2 Console Autolookup is licensed under the WTFPL License - see the LICENSE file for details