Tag Archives: is Php still relevant

Yii 2.0 Officially Released

The stable version of Yii 2 is officially released today and I thought I would mark the occasion by writing about it. I think the release of the framework is significant and it will impact PHP programmers for many years to come.

You can read the Yii 2 official release here.

The more I learn about Yii 2, the more I like it. Even though it was only in alpha when I started learning it, and the documentation was incomplete, I was able to go much further on Yii 2 than other PHP frameworks like Symfony and Laravel. Not only could I see obvious benefits in the architecture of Yii 2, but Yii 2’s advanced template provided me with enough structure out of the box to get something started, and that something included mobile-first bootstrap design with a working user model.

Sometimes, all we need is to be able to follow a well-thought out implementation and the advanced template is certainly that. With just a little modification, I was able to create a custom, and I should say simple, access control for admin, roles, user types, etc. I was able to do it quickly, getting an application going in about week, which considering where I was as a programmer when I started, was pretty cool.

Yii 2 is just incredibly well-thought out. It seems like the dev team has anticipated just about everything you could ever think of and found a way to support it. The behaviors and event architecture is feature-rich and very intuitive. And then of course there is Gii, the amazing tool that cranks out code for you and saves you even more hours of work.

I think the biggest frustration anyone feels learning a framework is dealing with the sheer size of it. This is true of any of the big frameworks and also true of Yii 2. You can’t just snap your fingers and master it.

Yii 2 is like a Ferrari. You want to jump in and go and leave tire tracks, but first you have to take the time to learn how to drive. What a drag.

Maybe that’s not the best metaphor because it should be understood that it takes significant time reach a level with PHP that allows you to run at high-performance. Gone are the days when PHP was just a quickie scripting language that let you build a form for your webpage. What we have now is more like rocket science, or, and not to be comical, more and more like Java.

Anyway, Yii 2 has a huge code base. When you work your way in recursively, deep into the framework, you find yourself in strange territory quickly. And I guess that’s what makes the surface so amazing. The deep wizardry is extracted to base classes that allow us to have these nice intuitive methods to work with.

I’ve documented hundreds of pages of work in Yii 2, so much so, I may even write a book for beginners on it. If you really want to learn something, try writing a book about it. It’s a very exhausting, yet effective technique.

And yet, for all that work, meticulously documenting controller methods, models, view architecture, and form models, etc., I still find it hard to explain exactly which features make me like Yii 2 so much. And I think the reason for this is a non-programming term: flow. Yii 2 just seems to flow.

I tend to think in creative terms. If I have an idea, I want it to flow. I don’t want the idea to come up against endless barriers because that is what kills ideas. The extent to which Yii 2 helps my creativity flow is a measure of how much I love it. And I love it a lot. It’s driving me to learn this alien rocket science, so I can take the new rocket ship up and see what the world looks like from that orbit.

A new generation of programmers will do the same. They’ll take it to heights none of us have ever seen before. PHP is in fact alive and well and flourishing in Yii 2. Check out the poll results in some of my other blog entries and you’ll see what I mean. I find this all very exciting.

Anyway, I’ll conclude by congratulating Qiang Xue, Samdark, Cebe, and the other dev team members for reaching such a great milestone. They made something really special. If I could say I only know one thing about programming, it would be this: it ain’t easy. So, great job guys and congrats again.

Advertisements

Is PHP still relevant?

Recently I began wondering if PHP was still a relevant language, considering that so much focus is on mobile and that would point towards Java and Objective C.  Also, I’ve recently begun investing a lot of time into learning the Yii 2 PHP framework, which I think is awesome.  Now awesome might not be considered a technical term, but I have to tell you, I don’t mind expressing my passion for something.  I’m a human first, engineer second.

I’m always looking to expand my education and the lack of new books on PHP worried me.  Was I wasting my precious time on a dead language?  It’s only when I looked for material on PHP frameworks, that I found a bunch of titles.  There were certainly a lot of Laravel books.  One thing that impressed me about Laravel is that they really tried to impement the ideas expressed in Robert C. Martin’s book, Clean Code.  Laravel has lots of pretty, semantically pleasing code.  So I played around with Laravel, but I didn’t feel it was quite at the level of Yii, and I just happened to be researching this when Yii 2 Beta came out.  I tried Yii 2 beta and fell in love with it, especially the advanced application template.  It gets you up and running with a mobile first Bootstrap impelmentation, with a working user registration model for both frontend and backend, right out of the box.

Books on Yii 2 are as of this writing, not out yet, but they are coming.  I think they will help usher in a new generation of PHP programmers who will take it to new a new level.  Applications will be built faster, with a more robust and extensible infrastructure.  As of this writing the general release for Yii 2 is about 30 days away.

So there is a lot to be excited about, but getitng back to the original question here, “Is PHP still relevant?”, I can’t help but wonder if it will be overshadowed, either by another language such as Ruby or by a mass migration off the web via mobile.  Of course the Internet wouldn’t disappear, but I could imagine websites as we know them being a relic of the past.

Anyway, I did some searching on Google and found this article on PHP which states that Google has determined that PHP is used on 75% of all websites.  If true, that is certainly a compelling and calming statistic. PHP is widely adopted and used, even if it is not always the flavor of the month.

PHP  does seem to have a lot of haters, and people who are into other languages such as Ruby are not shy about voicing negative opinions about PHP.  A lot of the complaints about PHP seem to be rooted in ideas about what a language should be.  It reminds me of the idealism I found in the Clean Code book.

Now I’m the first to admit, I’m not qualified enough in Java to review that book.  My only exposure to Java is a single book I read on it by Richard M. Reese, when I was recovering from Gall Bladder surgery.  Out with the gall bladder, in with Java.

Anway, I couldn’t help be impressed by the robustness of Java and how its best practices imply a strong architecture that guides a developer into following best practices.  That’s the good news.  On the other hand, it was my impression, from standing at the foot of the mountain, that it would take far more programming hours to do something in Java than it would in PHP.

Also, if PHP programmers tried to follow Clean Code principles too literally, they would bloat their code base with an unmanageable number of files.  I mean unmanageable from a server standpoint, that much PHP would bog down the server. You could have extremely clean code and extremely bad server performance.  Laravel for example, suffers from exactly these kind of problems.

You can solve those problems easily if you have enough money to throw at it.  You can hire teams of Java developers who can build an elegant archictecture that supports maximum code reuse and extensibilty, if I can be so bold as to use that phrase.  Or you could throw server resources at the problems and just feed the beast.  The thing is, doing so will cost you a fortune, and most companies don’t operate with those kinds of budgets.

PHP is a low-cost alternative to that.  So please don’t sneer at it, Mr. Investor, when a start-up tells you they are using PHP. The language, while not as robust as Java, has evolved, and become more object oriented in 5.4 than in previous versions, with namespaces, traits etc.  Frameworks like Yii 2, which use PHP 5.4 and above, can help you do amazing things in a rapid development environment, with templating and code generation.

So here I am making the case for PHP, but I don’t really need to.  The google stats speak for themselves.  Wise, pragmatic programmers already know that PHP is still very relevant.  This doesn’t say anything negative about other languages or frameworks.  They all have their strong points.  Liking one language is not a good reason to hate another.

And finally, looking into the crystal ball for the future, I will address the mobile issue.  I think we will see more cross platform development, like Zend is doing with their Zend Studio product, which I should note, I do not use, so this is not an endorsement.  But I do find interesting that you can build a front-end mobile app and have it be directly connected to your servers and your web architecture.

When I checked it out, I didn’t love the Zend PHP Framework, I didn’t find it intuitive or easy to use, so I’m not really following their IDE.  But I do think we will see more products like this in the future and ultimately, PHP will be supported.  After all, 75% adoption on the web is too much to ignore.

Vote in the poll at the top of the page about whether or not PHP is still relevant and let us know what you think.