We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

New Project: Codeigniter on HHVM or Phalconphp?

So, it came the moment in which I have to plan the architecture of my next project. It will be a large one, and will most likely require me to maintain the codebase for the foreseable future. It's a large shopping website, and will have to withstand heavy amounts of traffic.

In the last 6 years I've always used Codeigniter, I trust it to deliver what I need, its performances have been adequate for the tasks I've put it up to, the fact that it doesn't embrace OOP with PHP 5.3+ doesn't really bother me, I've grown accustomed to maintaining CI projects, even large ones, and I don't feel the compulsion to jump into a new framework because of that. Though, performance is a key factor. I was completely sold on Phalcon until I found out HHVM, and now I wonder.

Should I stick to what I know and take advantage of HHVM, or modernize my coding style and embrace Phalcon? I love the way phalcon devs work and approach upgrades. My biggest gripes with large frameworks has always been that many of them at some point feel bored and dive deep into massive refactoring, often for the sake of it, and break my code written in the past few years, forcing me to remain with an obsolete framework and potential security issues.

As far as I've read in these boards, Phalcon 2.0 will remain compatible with all the code written for 1.3. Can the devs be trusted to keep handling the framework in a way that warrants adoption in an enterprise environment? I love PHP and JS to pieces, but these days I envy Java developers for their ability to deploy large bodies of code and be able to keep them secure for decades.

What would you suggest guys?

Thanks in advance for your feedback!



26.3k

The only difference between Phalcon 2.0 and 1.3 is that Phalcon 1.3 is written in C and Phalcon 2.0 is written in Zephir. I am building now a project using Phalcon 1.3.3. I don't know C so when I want to check internal code of Phalcon, to find out how some method works, I simply check the code of Phalcon 2.0. Zehphir is very very very similiar to PHP. It takse like 1-2 hours to read all the docs.

What is more, I am going to switch from writing my app in PHP to Zephir. The product of my work will be an extension. So it will be fast (as Phalcon is) and I will protect my code from server provider administratos (data center administrators).

What design patterns are you going to use in your app? To understand my question, I am not asking about Gang of Four patterns but rather about patterns of enterprise applications described by Martin Fowler.

edited Nov '14

Still haven't distilled the full architecture, and part of the reason depends on the choice I'm going to make on the base framework and its overhead. Furthermore, I'm thinking about providing the backend as a collection of RESTful interfaces (so I guess the EIP patterns will come in handy?), in order to be able to swap the front-end seemlessly (so I can plug a mobile app on top of it, instead of the website).

The ORM in phalcon is tempting, I'm definitely going to use a relational database (thinking about postgres, but mysql is a strong contender, I'll investigate the best option for persistence based on horizontal scalability). At this point what I'm looking for in the backend framework is stability and a strong resilience to obsolescence. What you say about phalcon 2.0 and 1.3 gives me hope that it will remain consistent in its API.

I too was thinking about Zephir, if I have some heavy duty scripts to implement I would definitely think about writing them as extensions with Zephir!

The only difference between Phalcon 2.0 and 1.3 is that Phalcon 1.3 is written in C and Phalcon 2.0 is written in Zephir. I am building now a project using Phalcon 1.3.3. I don't know C so when I want to check internal code of Phalcon, to find out how some method works, I simply check the code of Phalcon 2.0. Zehphir is very very very similiar to PHP. It takse like 1-2 hours to read all the docs.

What is more, I am going to switch from writing my app in PHP to Zephir. The product of my work will be an extension. So it will be fast (as Phalcon is) and I will protect my code from server provider administratos (data center administrators).

What design patterns are you going to use in your app? To understand my question, I am not asking about Gang of Four patterns but rather about patterns of enterprise applications described by Martin Fowler.

edited Nov '14

By the way, I have no experience working for years in an Enterprise environment and the tecniques/patterns that facilitate development in an environment with tens of developers working on the same code base. So when I refer to the term in relation with the choice of technology what I'm concerned about is the kind of upkeep do I have to expect compared to Enterprise solutions. While I can patch any aspect of CodeIgniter myself, I cannot confidently say so about Zephir and Phalcon 2.0.

Again, if migrating to new versions of phalcon will always be mindful of previous code, my worries are dissipated, and I will probably gear up and look into it. The reason these worries are there is because I looked at what's happening with the transition in Laravel from 4.x to 5.x, and it's somewhat scary the amount of changes that happened there, including restructuring the filesystem layout.

I had a similar experience in the front-end realm with ExtJS going from 3.x to 4.x (which for me didn't happen, and I'm maintaining the whole 3.x branch myself now, because I couldn't possibly migrate over 250.000 lines of code and justify the development time to my clients).

Never again!

The transition from 1.3 to 2.0 doesn't follow the semantic versioning guidelines, so you're not going to see any breaking changes like Laravel or ExtJS doing a major version bump. While it is a major version number bump, the plan (as far as I know), is to make v2 100% compatible with v1.3.

That is very good news :)



13.4k
Accepted
answer

I'm currently working on a project for a company and it's my first project written using the Phalcon framework, I've got to say it's amazing. Even the ORM can play around with 1.7million rows from a relational database as if it's nothing.

Cannot wait to start building apps with Zephir, sounds really good for people who want to protect their code.

There was a post on here not too long ago with someone trying to compare HHVM and Phalcon and I posted a response there: https://forum.phalcon.io/discussion/3525/improvement-of-web-performance-with-phalcon-

Hi Rewtor,

thanks for you input, I'm happy about what I see, and I think I will adopt phalconphp for my project(s) from now on. I truly hope that new major revisions will be delivered with clear upgrade paths and without complete disruption of the semantics in existing deployments. Just out of curiosity, what database are you using? I've always used plain mysql with innodb containers for my databases, and was thinking about switching to either percona xtradb for clustering, or postgres.

I'm giving you the bounty prize since you are the only one that provided information regarding my question with first hand experience.

I'm using MySQL on my local development machine and MariaDB on the company servers. I will be changing my local version to MariaDB shortly.

I also use Phalcon's ODM with MongoDB.

edited Nov '14

:( hope they will fix this, despite the fact that I don't remember the day I last wrote a query without a decent limit.

Not a big issue for me as I use findFirst() to find my postcode records in this project, no manipulation will be done on the records and if there are changes it will be imported into SQL rather than using a Model.

Would be good if it was fixed though.

Absolutely amazing work there, keep it up!

You could try my Phalcon Webird framework if you want to protect your code. You can optionally configure it to make a dist build with all of the PHP protected with Ion Cube. I'm also looking at doing some work with Zephir but I'm waiting for some months.

I'm currently working on a project for a company and it's my first project written using the Phalcon framework, I've got to say it's amazing. Even the ORM can play around with 1.7million rows from a relational database as if it's nothing.

Cannot wait to start building apps with Zephir, sounds really good for people who want to protect their code.

There was a post on here not too long ago with someone trying to compare HHVM and Phalcon and I posted a response there: https://forum.phalcon.io/discussion/3525/improvement-of-web-performance-with-phalcon-