Support PHAR plugins

And make plugin internal handling more consistent