In my day to day life i tend to switch between Magento, Laravel and Symfony on a regular basis. Each system has it's pros and cons, but Magento has one pro over the other two: If you are using Magerun you can run console commands from any directory inside your project. It always bugged me that there isn't such a thing for Laravel, Symfony or other frameworks. That's why i created Shorty.
Do you want your Magento store to be more reliable? Tired of things that suddenly break the checkout process without anyone noticing? You can hire my services to kickstart End-2-End testing for your Magento store. This way you know for sure that your store is behaving as expected before releasing that new feature or that update.
View MageTested.com for more information.
With this library you can create a shortcut for any command. It's in an early stage, but i'm using it on a daily base already.
Shorty has only 1 dependency: You need to add
~/.composer/vendor/bin to your
$PATH. Most people already have this, so installing is only one command:
composer global require michielgerritsen/shorty
And that's it. Now you can add commands that should be globally available:
shorty add symfony bin/console
Now you can call this command from wherever in you system, it will always call this specific executable. But when you go to the next Symfony project, this will still call the executable from the previous project. Do we have anything for that? Yes:
With global commands you can create commands that checks your current folder and tries to find the specified executable. This way you can add a
symfony command which is available in every project in every folder.
So say you've added a
Symfony command. When browser you project you may end up in
app/logs. You check the error and realize you need to flush the cache. In a normal situation you have 2 options:
php ../../bin/console cache:clear
cd ../../; php bin/console cache:clear
Now with Shorty you just do this:
shorty global symfony app/console
Let's go over the options:
global- Make this command available in every project.
symfony- The alias, you could name this
app/console- The actual command that should be executed.
Support for Laravel
When installing Laravel on the recommended way, the artisan file is not executable. This prevents Shorty from running it in the default way. That's why you need to provide it with the interpreter is needs. You can add the artisan command to Shorty like this:
shorty global artisan artisan --interpreter=$(which php)
There are a few things i wish to add:
I've coded this project to check if this idea was feasible, so i didn't add tests yet.
Make sure the command actually exists so you don't add non-working commands.
Give a better error message.
Allow to enter parameters. This way you can easily create shortcuts for specific command, ie flushing the cache.
Add support for a few frameworks out of the box. Got a good idea you want to share? Open an issue or create a pull request.
View the code
As always, you can find the code on Github:
Want to respond?