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 :

1
2
3
4
5
6
7
$ 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 gave me the solution :

1
$ 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.

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:

Make your code deprecation free
Update to the new major version via Composer
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 :

phpunit

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

Read More

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 :

1
$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.

Read More

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.

Read More

Coding everywhere using an Android device

Some while ago, I used to code with my laptop on my knees in the public transportation. That way, I made significants contributions to rss-atom-bundle and I’m sure this bundle wouldn’t be the same today without it. Meanwhile, coding with a 15’’ laptop in the subway means troubles with other passengers or the laptop itself like complaints, purse shots in the screen or a computer getting very hot on your knees. So I decided to keep it home.

But I couldn’t resist, I needed to keep working on open source projects so I tried to do it with a system closed to what I know on a smaller device. The Nexus 7 tablet is a good candidate for that and you’ll see in this post how I managed to set up a development environment using applications available on Google Play. I ended up with the ability to push commits on Github and to run PHPunit inside my projects.

Read More

rss-atom-bundle 2.2 is out

rss-atom-bundle 2.2.0 has just been released. It brings the following :

  • exceptions are all under the same namespace
  • ability to write enclosures
  • cache-control can be set to private if you need to disable caching from proxies

This version breaks backward compatibility, the upgrade process from 1.x is described in this notice.

Why a 2.x version ?

Two weeks ago, Soullivaneuh and Romaric Drigon created 7 pull requests in less than 48 hours bringing new features, code cleaning and a better exception handling. Before that, I merged a pull request fixing Symfony 3 compatibility. Although I announced at the beginning of the year that FeedIoBundle will be the next rss-atom-bundle and scheduled its end of life to match the 2.x branch of Symfony, things turned differently. Some developers are still using rss-atom-bundle and they submitted pull requests to make it last longer than scheduled. I respect that and it makes me realize rss-atom-bundle is not under my sole control anymore, which is exciting.

As a consequence, rss-atom-bundle will be maintained to be compatible with both 2.x and 3.x branches of Symfony. The next version will feature a new RoutedItemOutInterface as specified in this issue, however its release date is still unknown.

feed-io 1.0.0 : a PHP library built to serve and consume Atom/RSS feeds

feed-io has now finished its beta stage and is ready to be used in production environment. This library is 100 % pure PHP and depends only on PSR-2 for logging specifications. It also suggests Guzzle to consume external feeds, and if you don’t like this choice you’re free to write your own HTTP client and use it with feed-io.

features

Features are already listed in this previous post

To make it short, feed-io is able to serve and consume RSS / Atom news feeds with a strong OOP approach. It is flexible and you can use it to extend standard formats or to create your own if you need to.

design

feed-io is designed to be easily understood by anyone who wants to use it. It provides a façade to help you with the most common operations, but if you need more flexibility you can use the core classes.

Read More