Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Converting Phalcon back to PHP for clients with their shared hosting plan

Hi everyone, I was wondering if this stupid idea of mine could work. I'm thinking on changing from CodeIgniter to Phalcon, but some of my clients, have their own shared hosting plan that I can't install the Phalcon as C extension. Then I came across with this repository: https://github.com/phalcon/cphalcon/tree/master/phalcon and wondered for a moment... what if I changed all this files extention from .zep to .php ?

This is a stupid idea, but will it work? I understand that even if possible the speed of phalcon would be lost, but could the framework actually work?



42.2k
Accepted
answer
edited Jan '16

IMHO, It's just plain stupid thing to do. Not because of your idea technically speaking, but because of making everyone else concessions over something which is purely software based (installing some binary packages system wide). Yes, shared server is a pain in the ass for Phalcon, but what can you do, those clients are usually fine with a raw php or whatever other framework/cms out there.

That's why Phalcon have such good reception in an enterprise environments, where you have the freedom of choice to setup everything etc.

At the end of the day, if some hosting company would want to support Phalcon, it's not a hard task, just like they maintain their other .so binary components, i.e. CURL extension or PDO etc. They are not there by default...

Task of converting zephyr code 1:1 to native PHP could be done, but such task is cumbersome to me.

And if you still want to try such thing, this is a good reference for start: https://api.phalconphp.com Take a note on "Source" button located on every class/namespace. It's really useful. I copy/pasted some parts of some classes out there in order to override them while keeping the same interfaces.

Thanks for your answer stamster. Let me ask you a personal question, have you faced a situation where you couln't use Phalcon? What would you went over instead? And you choose that other option because it was similitar to phalcon or because of previous knowledge?

edited Jan '16

I'm not sure I understand your question. What are your concerns? Technical barrier where you need Phalcon to be compiled as PHP .so extension? Or more 'academic' concern, whenever Phalcon vs. Laravel or some other FW out there...

I can tell you in any case that the Phalcon is the way to go if you want:

  • Highly decoupled framework
  • Dependency injection container implemented in a way easy to understand
  • Little to no overhead comparing to other FW's
  • Flexibility as much as you can using any framework out there

The only downside at this point would be lack of proper documentation for some components. But once you're used to read Zephyr code, you can do pretty much everthing on your own. And my personal downvote would go to ORM, since I'm not a fan of ORM and Select + 1 issues and other constraints out there. I model my database in a proper way - so I don't need intermediate mapping. I even implemented Models in a same way as Phalcon, but without ORM or PHQL.

Else, feel free to ask more specific question. :)

It might be good for you, my list of tools of choice for the entire stack:

  • nginx
  • PHP-FPM
  • MariaDB / MongoDB
  • GNU/Linux (mandatory)

And obviously Phalcon if you plan to use FW at first place :)

Humm, I see. That helped me a lot.

Thanks