W87 is believed to have a weight of 200-270 kilograms, was originally 300 kilotons but an upgrade to 475 kilotons should be possible. A space-based nuke will have a lot of stuff - like ranging, manuvering propellant potentially, etc, but would also lack a reentry vehicle. It would however be advantageous if the device itself is protected against reentry though, to prevent the spread of radioactive materials in the event of a launch accident. On the other hand, since the materials within the device are not highly radioactive, it might be politically advantageous to ensure the device does disentegrate on reentry, so that nobody can claim the nation(s) launching the mission are on some sort of nuclear offensive.
My crude calculations show that a 475 kiloton warhead could impart at least 0.485 m/s to an object with the mass of Apophis, however, I did assume Apophis was spherical and made of pure carbon, for simplicity's sake.
Not only is flying that sort of mass to an asteroid-type object possible, but we've done it, during the Deep Impact mission. Deep Impact cost $330 million for developing the spacecraft and completing the mission. Encountering other red tape and the inclusion of nuclear devices etc, might drive the cost up to around a billion, and even then the cost of launching two or three spacecraft is still relatively attractive when compared to a gravity tractor, which would probably cost more than $100 billion alone.
Anyway as far as large scale disasters go major impacts like Apophis are relatively rare. I would be more worried about large volcano blowing up. For example a VEI 7 scale volcano erupting in some densely populated area would be a natural disaster far larger than anything our modern civilization have faced. Imagine Tambora v2.0 happening nowadays in overcrowded Indonesia. And there is nothing to be done to prevent it from happening. Such eruption could cause global climatic disruptions with a potential for large scale crop failures.
I wouldn't even call a potential Apophis impact a large scale event, it would be a massive disaster but relatively small compared to say, even a 1 kilometer wide object.
The difference is, of course, that we have the potential to prevent an Apophis impact. We don't have that potential ability with any other natural disaster phenomenon. With for example, what would be an extremely destructive and deadly modern eruption of Mount Tambora, all you can do is try to prepare. You can't prevent it, you can't stop it.
He who says he does not care about Apophis, is a bad soul. Whether or not it actually will pass through the keyhole isn't what's up for debate, it's what we do if data shows that it will. Would you have prevented the 2004 indian ocean tsunami, if there was a chance that you could? Would you have tried to prevent the deaths of 230 000+ people?
Now what if I told you that
if Apophis hit central America, it could kill
10 million people? Or that if it hit somewhere in the Pacific, it would create a large tsunami that would affect the
entire Pacific Rim?