PHP: Seven PHP developers you should be following on Twitter

A couple of days ago, a friend of mine looking to engage in the community asked me which experienced PHP developers he should follow on Twitter. An interesting question, and as I started looking through the @setfive follower list I realized we really don’t follow very many. Anyway, not wanting to leave him hanging, I put together a list of 5 developers that I thought were a good start.

This is obviously just a start, but I’d love everyone’s help to build out a list of solid PHP developers to follower on Twitter. If you leave them in the comments, we’ll pull together a single list and update this post once we have it!

Fabien Potencier

Co-founder and CEO for @SensioLabs, founder and project lead for @Symfony.
Tweeting from @fabpot and on the web at http://fabien.potencier.org

Jonathan Wage

Husband to @meganswage and director of technology @OpenSky. @ServerGrove @Symfony @DoctrineORM
Tweeting from @jwage and on the web at http://jwage.com/

Kris Wallsmith

Lead architect & symfony guru at @opensky. lead dev on assetic, buzz, spork. father of 3, widower of 1.
Tweeting from @kriswallsmith and on the web at http://kriswallsmith.net/

Chris Corbyn

Nerd, englishman, chatterbox, cake-a-holic, celery hater, Italophile, nu-melbournite, SitePoint/Flippa code monkey. I’m also @cosadici.
Tweeting from @d11wtq and on the web at http://chriscorbyn.co.uk

Dustin Whittle

Technologist, Architect, Open Source Advocate
Tweeting from @dustinwhittle and on the web at http://dustinwhittle.com/

Dries Buytaert

Creator of Drupal, Drupal project lead, co-founder and CTO of Acquia, and Mollom spam fighter.
Tweeting from @Dries and on the web at http://buytaert.net/

Lukas Smith

My twitter alter-ego is all about PHP and databases. My coding addiction is financed by @liip.
Tweeting from @liip and on the web at http://www.liip.ch/en

Joseph Bielawski

Software Developer – #Symfony2 #PHP Polish Twitter Translator
Tweeting from @stloyd and on the web at https://github.com/stloyd

Robin Muilwijk

Board member, eZ Publish Community Project Board : Open Source Advocate : Community Management : Social Media : Civil Servant : Information / Data Engineer
Tweeting from @i_robin and on the web at http://www.linkedin.com/in/robinmuilwijk

Anthony Ferrara

Anything Regarding Software Security, Performance, Quality and Architecture…
Tweeting from @ircmaxell and on the web at http://blog.ircmaxell.com/

Nikita Popov

18 year old student enjoying programming :)
Tweeting from @nikita_ppv and on the web at http://nikic.github.io/

Igor Wiedler

Philosopher.
Tweeting from @igorwesome and on the web at https://igor.io/

Matthew Weier O’Phinney

PHP and ZF Developer; crazed father of two.
Tweeting from @mwop and on the web at http://www.mwop.net/

William Durand

Student by day, full stack developer by night. Open-Source evangelist all the time.
Tweeting from @couac and on the web at http://careers.stackoverflow.com/williamdurand

Jordi Boggiano

Passionate web developer, specialized in web performance and php, #Composer lead, #Symfony2 developer. Partner at @nelmio, information junkie and speaker.
Tweeting from @seldaek and on the web at http://seld.be/

Giorgio Sironi

Developer at @Onebip. I search for the harmony between form and context. Software, science, economics.
Tweeting from @giorgiosironi and on the web at http://www.giorgiosironi.com/

Symfony2: Creating optgroups with an Entity type

Last week, I was working on a Symfony2 app where I wanted to generate optgroup tags inside the select box of an Entity form type. After poking around, I ran across a StackOverflow answer explaining how to do it. Basically, it turns out what you have to do is manually return a “choices” array from a class that has access to the Entity Manager. I ended up adding a method to my custom repository and passing that repository into my form:

It’s a bit messy and I’m surprised there isn’t an option on the Entity Type to pass in a callback with access to the Entity Manager to generate a choice list. Looking at the source of DoctrineType it looks like you could potentially create a custom type to extend the Entity type and then access the em from your custom function. Even that though, seems like overkill to accomplish something that is reasonably common.

Musings: 3 reasons if Google Wallet owns the pipes it’ll be a win

Last week, at Google I/O Google announced a set of sweeping changes to their Wallet product. CNet has a decent run down of what they announced but basically it boils down to the ability to “send money with GMail”, Wallet integration into Chrome to decrease payment friction, and “instant buy” with Google+. All in all, the announcements are interesting but I think what’s more exciting is the potential for Google to truly innovate in the payments space.

In the last few years, companies like Square, Dwolla, and Stripe have been innovating in the payments space but they’ve all been reliant on existing credit card infastructure. With the exception of using Dwolla as a replacement for a check, each of the companies still relies on charging a user’s credit card to complete the transaction. I think this infrastructure piece is the key pinchin for Google Wallet. If Google can sidestep the existing payments infrastructure for Wallet, like they did with the telcos for Fiber, they’ll end up redefining how digital payments work.

Ok, so they own the infrastructure now what can they do?

Better risk analysis, lower costs

As far as processing payments go, cost is ultimately one of the most important factors used in picking a processor. The pricing is so opaque that FeeFighters basically built and sold a business simply by explaining in straightforward terms which processor was the best for your business. If Google had the freedom of controlling the pipes, they’d be able to lower their pricing below everyone else by introducing better risk analysis tools into their payment solutions.

Looking at how the APIs from companies like Authorize.net work, they basically only accept the minimum information required to charge a credit card and nothing more. Google would be able to modernize this by incorporating additional “verifying details” about a user to reduce the risk on a transaction. For example, a charge originating from a 2-factor authenticated Google Wallet user that is at their “home” computer is obviously much less of a risk than an anonymous user using a credit card for the first time. By segmenting risk by user, device, as well as transaction type Google would be able to offer the best rates for “normal” transactions and also accept “high risk” transactions.

Give NFC payments some teeth

Google has tried to push out the NFC powered version of Google Wallet in 2011/12 but it was immediately blocked by major American carriers because it competed directly with their ISIS solution. It shouldn’t come as a surprise that the telcos didn’t want to get relegated to “dumb pipes” for payments as well but it’s also not like ISIS has garnered any real traction either.

If Google controlled the entire stack and could successfully convert Android users to Wallet users, they’d be able to essentially pay the carriers “blood money” to lift the Wallet ban to drive adoption and then hopefully reach a more permanent deal.

Ultimately, true mobile payments need to be freed from the existing credit card restrictions and Google could be poised to deliver just that.

Micropayments that work

People have been talking about “easy” micropayments on the Internet for several years but they haven’t really shaken out. Even today, charging someone $1 for something is a huge PITA and it really isn’t even practical. Between fees and long payment forms, the micropayments still aren’t economically feasible.

With Wallet integrated into Chrome and the infrastructure under their control, Google would be able to tackle this head on by reducing the friction to completing a payment and offering different pricing models for micropayments. Think 2 click checkouts for transactions under $5 and a monthly fee of $5 for merchant accounts in good standing instead of transaction fees.

Despite some reservations, I’m excited to see what Google ends up doing with Wallet and how it ultimately influence the payments space. Another big question is what’s Facebook going to do? Revamp Facebook Credits? Start offering co-branded Facebook credit cards?

Anyway, thoughts or comments welcome.

Symfony2 and Impersonating Users, a Heads Up

Recently I was working on a project in which it admins were able to impersonate other users.  It’s a fairly easy task to add to Symfony2, merely adding a switch_user reference to your firewall can make it possible, consult the Symfony docs for more on that.  One thing I noticed was that every now and then when testing I would get weird errors after switching between multiple users, however it didn’t always happen.  After some digging around, it turns out when you switch user it does not clear that sessions attributes, ie if you set attribute ‘hello’ to value ‘world’ it would persist after you’ve impersonated another user.  This caused a few issues as on this application we used the session to store a few things like which set of database connections you currently use.

After looking at the SecurityBundle configuration setup it was clear that there wasn’t any options to have it clear all session attributes on switch user.  At this point it was clear I needed to use an event listener as the firewall dispatched the SwitchUserEvent when a user successfully switched user.  Below is an excerpt from my services.yml
This makes it so that it will call the following code on a successful impersonation of a user:

It’s as simple as that, you can get the actual user by calling $event->getTargetUser(). Long story short, the session can have some tainted values when using switch user as all attributes are not cleared.

Bootstrap: Can you rotate Bootstrap icons? Sure you can!

Earlier this week, I was doing some work on a project that was using Twitter Bootstrap and was exclusively using Glyphicon icon set that ships with Bootstrap. The piece of functionality I was building basically involved allowing the user to rotate an image 90 degrees clockwise or counterclockwise. Looking through the Bootstrap icon set, there’s only a “rotate” icon which would work for the “clockwise” rotate but no analogous icon for a counterclockwise rotation.

I didn’t really want to use a custom icon just for this button and I really wanted to consistently use the “icon-*” class names that natively ship with Bootstrap. I’ve used CSS transforms in the past but I wasn’t sure if they’d work for “background-images”, turns out they actually do. In essence, what that means is that I’d be able to use the same “rotate” image for both the clockwise and counterclockwise icons. The CSS you’ll need to do this is:

And then to use it, you’ll just need HTML that looks like:

Of course, you’ll have to be cognizant that this is only going to work on “modern browsers” (looking at you IE), so if you’re supporting older clients you’ll need to mitigate that.