The most popular Composer / Packagist PHP packages

There’s no doubt that Composer is the way of the future for PHP, but Packagist (the package archiver) is woefully lacking in useful information.  Well actually, the information is there, there just isn’t a way to get at it.  For example, I was looking for an asset manager and typed in assets, and I couldn’t figure out how they were ordered… and there’s no way to reorder them.

I figured by now, someone MUST have built a user-ratings system for the packages. But after weeks of searching, I haven’t found any. So I figure I might as well start. Right now, I’ve only got a list of all the packages, and they’re ordered by descending total number of downloads:

It shouldn’t be too difficult to add in up and down ratings and comments. The biggest issue is getting the stats.  Packagist doesn’t have an api (that I can see) that exposes the packages’ info, like tags, downloads, and such. The info I have was a quick scrape, and that’s not something I want to keep doing.

So, here are the top 10 PHP composer packages by installs:

Package Description Downloads (as of 12/17/2012)
twig/twig Twig, the flexible, fast, and secure template language for PHP 279,980
symfony/symfony The Symfony PHP framework 231,115
doctrine/common Common Library for Doctrine projects 230,744
doctrine/dbal Database Abstraction Layer 217,669
monolog/monolog Logging for PHP 5.3 198,494
doctrine/orm Object-Relational-Mapper for PHP 197,518
swiftmailer/swiftmailer Swiftmailer, free feature-rich PHP mailer 172,327
kriswallsmith/assetic Asset Management for PHP 166,350
sensio/distribution-bundle The base bundle for the Symfony Distributions 149,974
sensio/framework-extra-bundle This bundle provides a way to configure your controllers with annotations 149,437

Autoloading Organized Routes in Laravel

This is an excellent tip from Jesse O’Brien about breaking up your Laravel routes file.  I’ve actually done something similar for a while now, and kind of forgot that Laravel doesn’t come preconfigured this way.

First, in the application directory, I create another directory called “routes”.

In that directory, I have a “filters.php” and “events.php” and some other files to hold my GET and POST routes.

Then in the start.php, I drop on this bit of code:

foreach (scandir(path('app') . 'routes') as $filename) {
	$path = path('app') . 'routes/' . $filename;
	if (is_file($path)) {

This way, you can add as many routes as you want, and they’ll all load.

I’ve toyed with the idea of scanning for directories in the routes folder, and including those as well… but if you’re at that point, you should probably just use controllers.

Great Read – On Being a Senior Engineer

This is an excellent rundown about what being a “senior” engineer is all about.  Being part of a well-oiled development team, I really try to live up to these standards.  I especially like the “Ten Commandments of Egoless Programming” that he posts:

  1. Understand and accept that you will make mistakes. The point is to find them early, before they make it into production. Fortunately, except for the few of us developing rocket guidance software at JPL, mistakes are rarely fatal in our industry. We can, and should, learn, laugh, and move on.
  2. You are not your code. Remember that the entire point of a review is to find problems, and problems will be found. Don’t take it personally when one is uncovered. (Allspaw note – related: see below, number #10, and the points Theo made above.)
  3. No matter how much “karate” you know, someone else will always know more. Such an individual can teach you some new moves if you ask. Seek and accept input from others, especially when you think it’s not needed.
  4. Don’t rewrite code without consultation. There’s a fine line between “fixing code” and “rewriting code.” Know the difference, and pursue stylistic changes within the framework of a code review, not as a lone enforcer.
  5. Treat people who know less than you with respect, deference, and patience. Non-technical people who deal with developers on a regular basis almost universally hold the opinion that we are prima donnas at best and crybabies at worst. Don’t reinforce this stereotype with anger and impatience.
  6. The only constant in the world is change. Be open to it and accept it with a smile. Look at each change to your requirements, platform, or tool as a new challenge, rather than some serious inconvenience to be fought.
  7. The only true authority stems from knowledge, not from position. Knowledge engenders authority, and authority engenders respect – so if you want respect in an egoless environment, cultivate knowledge.
  8. Fight for what you believe, but gracefully accept defeat. Understand that sometimes your ideas will be overruled. Even if you are right, don’t take revenge or say “I told you so.” Never make your dearly departed idea a martyr or rallying cry.
  9. Don’t be “the coder in the corner.” Don’t be the person in the dark office emerging only for soda. The coder in the corner is out of sight, out of touch, and out of control. This person has no voice in an open, collaborative environment. Get involved in conversations, and be a participant in your office community.
  10. Critique code instead of people – be kind to the coder, not to the code. As much as possible, make all of your comments positive and oriented to improving the code. Relate comments to local standards, program specs, increased performance, etc.

I like to think I live up to most of those, though I’m somewhat (sometimes very) guilty of #9.