How to fix Composer’s slowness

You may have notice that Composer can get really, reaally slow on some setups. This is the case at my office, so I tried to find a solution. Let’s run Composer in very verbose mode :


# composer -vvv require phpunit/phpunit
Reading ./composer.json
Loading config file ./composer.json
Checking CA file /etc/ssl/certs/ca-certificates.crt
Downloading https://packagist.org/packages.json
Writing /root/.composer/cache/repo/https---packagist.org/packages.json into cache
Downloading http://packagist.org/p/provider-2013%24fabc3be20d24d6af724445e1f9f6cf7a891f5e0d752c3ee50e5de928877bf21e.json

And it seems to get stuck here. In fact, it’s not. If you wait for a little while (let’s say, 2 or 3 minutes), Composer stores the file in cache and downloads the next provider-*.json file. Which takes 3 more minutes and Composer won’t finish its downloads soon because, it will download more than 10 files after that.

But Google is great and it (he ?) gave me the solution :


# composer config --global repo.packagist composer https://packagist.org

And now it runs fast. Just because sometimes, Packagist is slow through HTTP without SSL.

Please note : PHP must support SSL for this to work.

Advertisements

A successful upgrade from Symfony 2 to 3

As Feed-io-bundle is now Symfony 3 compliant, the next logical move was to upgrade its demo. The application is just composed of the bundle itself and Bootstrap so the upgrade process should be easy to follow. Let’s see what’s in the documentation :

There are a couple of steps to upgrading a major version:

  1. Make your code deprecation free
  2. Update to the new major version via Composer
  3. Update your code to work with the new version

Three steps and every thing seems cristal clear, here we go.

Replace deprecated code and configuration

According to the cookbook, you’ll have to replace everything that became deprecated during Symfony 2’s evolution. To go through the first step, Symfony provides a package called symfony/phpunit-bridge which detects deprecated parts of your code and shows you the way to correct it. Another way to go is to pay attention to deprecations Symfony notices to your application’s log, which means to manually test the whole application. Good luck with that. feedio-demo has unit tests (well in fact, one), I’ll use the bridge :

image

OK, that’s easy. Only one configuration to fix and feedio-demo is ready for the dependencies upgrade.

Continue reading

A factory in feed-io v2.2

In feed-io 2.2, I introduced a Factory class built to get a FeedIo instance in one single line of code :

$feedIo = \FeedIo\Factory::create()->getFeedIo();

Obviously this works assuming that you installed feed-io using Composer and you have included vendor/autoload.php before.

Factory’s main method : Factory::create()

The factory comes with the ability to configure feed-io before getting its main class. For that, you will provide one or two configuration arrays depending on which dependency you want to configure.

Continue reading

feed-io-bundle 3.0 to support Symfony 3.0

Edit : the bundle is no longer supported, see this announcement

I recently released version 3.0 of feed-io-bundle. Symfony 3.0 introduced a backward compatibility break in forms support, so it became impossible to maintain a code base compatible with both versions.

Symfony 2.x support

I created a branch called release/2.x to maintain feed-io-bundle version 2. It will last until the end of the Symfony 2.x official support. This branch will be used for bug fixes only, all the new features will be committed to the master branch.

feed-io-bundle v2.1.1 is out

Edit : the bundle is no longer supported, see this announcement

I recently released version 2.1.1 of feed-io-bundle. This is a major release as it introduces a web interface made to manage feeds and their content which you can try live here : http://feedio-demo.herokuapp.com/.

It’s also official : feed-io-bundle replaces rss-atom-bundle. If you’re starting a new Symfony project, I highly recommend you to use feed-io-bundle instead of rss-atom-bundle. feed-io-bundle will be upgraded regularly with new features and fixes among compatibility with Symfony.

Rss-atom-bundle’s support

rss-atom-bundle is not condemned to disappear immediately, I will provide a “passive support” until it’s not used anymore. By passive support, I mean taking care of open issues and pull requests until the end. So if you already have a project depending on rss-atom-bundle you don’t have to be afraid of this announcement, I’ll always be able to help.

Coming next

I’m working on two things by now :
– Symfony 3 compatibility
– the ability to analyse feed’s quality with feed-io

To write PHP applications with Android : use GNURoot Debian

In a previous post I wrote about the possibility to develop PHP applications using a tablet. The main trouble was to find a reliable application to run a web server with a recent version of PHP featuring xDebug and the ability to run unit tests. It’s manageable but not fully satisfying so I kept looking for another solution.

Then I found GNURoot Debian and it changed everything : Debian Jessie running inside a virtual machine, you can’t ask for more.

I tried several Linux emulators and GNURoot Debian was the only one to work easily without tweaking its configuration. For instance, LinuxDeploy seems very powerful but it never managed to write its configuration on the file system. Even the higher level of logging didn’t point out what the real problem was.

Continue reading