Installing / updating Composer dependencies is very slow or time outs

I wanted to speed up my coding by adding Laravel 4 Generators and Laravel Artisan plugin for Sublime text 2 (you can learn more about this here). I added "way/generators": "dev-master" to my composer.json file as instructed and ran "php composer.phar update" and waited….and waited…and waited. How can downloading simple text files be so slow when I have very fast connection?

For some reason I always had problems with composers speed – installing or updating dependencies was very slow. By searching net I saw that a lot of people have similar problems and various solutions are offered – for some they work and for some they don’t. I would advise you to try them out and see if any of them help you.

One of the most common advices is to use the --prefer-dist switch:

php composer.phar update --prefer-dist

I ran it however it didn’t help me. Composer got stuck on updating symfony/filesystem dev-master. After 5 minutes I got this error:

[Symfony\Component\Process\Exception\RuntimeException]
The process timed-out.

After trying it few times with the same result I realized that git.exe was having some problems with my network (not sure what). So the problem seems to be with Git protocol, at least in my case. Composers default github-protocols config settings is ["git", "https", "http"]. So what I did was changed github-protocols to https with this command:

php composer.phar config -g github-protocols https

I ran the update again and it started working, much faster and no timeouts.

Note: I don’t know if this was due to me canceling composer updates several times but after composer finished updating I got this error for the first time :

Fatal error: Call to undefined method Illuminate\Foundation\Application::getConfigLoader()

The solution for this can be found here.

Sublime Text 2 opens “instant file search” instead of printing left square bracket in Windows

This problem only appears on certain keyboards and languages where left and right square brackets are placed on letters F and G. Even if you have similar problem with different keyboard or key binding /letters you can still use this solution.

I was using Sublime Text 2, which is really fantastic editor, on Windows 7 and encountered a weird problem. When I pressed AltGr+F Sublime Editor 2 didnt print “[” (left square bracket) – it opened Instant File Search tool instead.

The reason for this is that Windows sees AltGr as Ctrl+Alt, and therefore AltGr+F will be understood as Ctrl+Alt+F, which is a default keymap for Instant File Search tool.

To fix this you need to override the default Ctrl+Alt+F shortcut so it will insert the desired character by inputting that shortcut in user key-bindings.

Do this:
1. Select “Preferences > Key Bindings – User” in Sublime Text 2 menu
2. Paste the following code there:

[
{ "keys": ["ctrl+alt+f"], "command": "insert", "args": {"characters": "["} }
]

If your Key Bindings – User file is not empty then just add the code without the square brackets (line 1 and 3) and dont forget to add comma at the end or at the begging of the line.