CakePHP 3.0 Retrospective

With CakePHP 3.0 out the door, I thought it would be good to reflect on the project. CakePHP 3.0 is the longest and largest open source project milestone I’ve ever participated in. At FreshBooks we do retrospectives on large projects as a way to see what went well, and what could have gone better. The goal is to discover things we should keep doing, and what to improve the next time around.

Things that could have gone better

  • Project duration. 3.0 took a massive amount of time – almost 2.5 years. I don’t think any of us anticipated this kind of time commitment originally. Furthermore, 2.5 years is a long time to not have a new release for a community. I feel that CakePHP probably lost a sizable chunk of our users to other frameworks because people’s perception was that the project was not advancing.
  • The number of breaking changes. 3.0 is the single largest API break CakePHP has ever undergone. This will likely inhibit upgrading and possibly fragment the community. It might have made more sense for us to create a new standalone ORM, and release plugins for all the new features in 3.0.0. If I ever have to do something like this again, I’ll probably explore that approach instead.
  • Incomplete examples of alternative datasources. Previous versions of CakePHP had a accepted way to add support for non-relational stores to the model system. Because we wanted to deliver a fantastic ORM, we had to sacrifice the previous abstractions. What we failed to do was show how one could build a datastore integration for non-relational databases. Jose Lorenzo and I have started to work on an elastic search plugin with the goal of giving a powerful ORM on top of a non-relational store that can be an example for others.
  • Building standalone console apps still not great. While 3.0 improves many parts of the framework, the console libraries are not significantly better. I hope that in a future version we can deliver console tools that are as great as our web tools.

Things that went well

  • Plugins for bake, migrations, and separate repository for app skeleton. These were somewhat controversial changes when proposed, however they have already started to yield benefits. Not only can bake no longer be installed in production environments, but we can release bake, and migrations more frequently than the core libraries.
  • Component Libraries We spent a good chunk of time detangling CakePHP for 3.0. The result is that we now offer several slices of cake as standalone libraries. The collections, database, and ORM packages are particularily nice.
  • Leveraging existing libraries. CakePHP previously had a long history of re-inventing all the things. To be fair, CakePHP started well before sharing code between libraries was easy or manageable for normal people. Composer changed how PHP libraries are consumed, and I’m really happy that we decided to use external libraries for features like datetime handling, the interactive console, migrations and shim libraries.
  • New ORM. I’m really happy with how the new ORM has turned out. Jose Lorenzo really outdid himself with it. I think it is one of the most flexible, powerful and feature rich ORMs for PHP.
  • New website done for release day. I had my doubts that this was going to happen, but the folks at CakeDC did a great job in getting the site ready.
  • Docs completed at the same time as code. For 3.0, all the documentation was written with or shortly after the code was completed. This let us have current and correct documentation at each alpha, beta and RC release. While we started this practive during the 2.x releases, it really proved itself during 3.0. I’m also a firm believer in writing documentation before you write code as a cheap way to ensure the resulting API is solid.
  • Lots of early great feedback from the community. Even though we were iterating quickly and releasing lots of breaking changes we still had good involvement from the community. I’m very thankful that we had great feedback throughout the development of 3.0.

While this list is mostly a brain dump of things I’ve thought about 3.0, I’d love to hear your thoughts as well.

Comments

Hey Mark,

Nice post :).

I was looking at CakePHP orm on the other day to make use of it as a standalone. And one of the things that I am sure people will be confident to use your libraries are the trust that, you guys will maintain the project and the support of the community.

One question I asked myself was whether there is any benchmarks for the ORM and how easy is to test the Entity classes.

I still need to explore more to get there.

Keep the good work.

Hari K T on 4/10/15

Hari K T: I’m not aware of any benchmarks for the new ORM vs other projects like doctrine, PHPActiveRecord, or Laravel. Testing the Entity classes should be very simple. Applications don’t have to inherit from the framework, and instead can implement an interface and trait. Entities also don’t have any hard dependencies on the rest of the ORM. In test cases you can build the entity state you want by using @new Article()@ and write tests against the in memory state.

mark story on 4/11/15

Great summary Mark, I’d say that given all the variables during the development of CakePHP 3 the result is really amazing. A massive shout out to the community as well, for all of the time and effort they’ve dedicated to help get us where we are today. Without a doubt an awesome experience!

James Watts on 4/11/15

I am one of the CakePHP “users”, still not contributor. I was waiting a long time for CakePHP 3. At the end i became a little insecure whats going on “inside” there. When i visited the CakeFest in Madrid and saw the great Cake Team, that was a nice experience for me which gave convidence to keeep on going ahead with Cake.

I have done several projects using CakePHP 1 and 2 and started now my first “big” project with CakePHP 3.

I agree with you, it will be not easy to migrate existing V.2 Projects to V.3 and i still don’t know if i’ll try it. First i have to learn more and get more confident with V.3.

For a “normal” Freelance programmer as i am, which also dedicates part of his time to Frontend Design (Bootstrap…), customer relation, hosting, design… its seems to be at the first moment a very big change, what happened there in CakePHP.

But i have to say that all the changes, especially the new ORM, at the end will help us to save a lot of time.
I spent in V.1 and V.2 often lots of hours to find out how to get the database queries working in the Cake way. I always found the trick at the end, sometimes deep in the night, but we know all about that.

Mark, it is very interesting to read here your retrospective. To know about these reflections from someone like you, a real insider and important part of CakePHP, is important for the Cake Users like me.

Thats why i just want to say thank you.
And also thank you for all the fantastic work and contribution, which you and the others contributors are doing.

Regards, Martin

Martin on 4/12/15

Great retrospective. Thanks for sharing your thoughts, it’s always good as an outsider to read the feeling of core members of a big projects.

I kind of followed the 3.0 development starting from the second dev release (at least once a week at first and once a day for the last 3 months).

I’d say that the biggest challenge the core team had to face was the big gap between the “technological” state of the 2.X release and where the PHP community was going.

As you said, it’s the biggest break the framework has undergone, but I think the Cake 4.0 release won’t be that big of a deal (well depending on what will come…).
You guys managed to almost sync with all the new technologies and pratices that rose from the past 2 years.

In my opinion, the biggest challenges to come will be :
- to keep that synchronicity to avoid the “this framework is not evolving” feeling people might have felt with the 2.X release and not lose users with the 3.X users.
- do things for “lost” people to not feel that towards Cake anymore
- evangelize new users to Cake
- put more awesomeness in the framework

I think that sums it up.
Keep up the awesome work, it’s really appreciated.

Regards,
Yves.

Yves P. (HavokInspiration) on 4/23/15

Thanks for the 3.x upgrade. We’ve been waiting for this quiet a while. I’m digging into it. For one, I like the feature that composer is used to update vendor plugins.

I studied and used CakePHP 2.x for quiet a while. But got stuck in the overuse of conventions, so at least I experienced that at the time, learning MVC 3 years ago.

So I started to learn and use laravel. The setup of laravel is easier, the conventions simplified. The problem with this framework is it uses in every upgrade the latest PHP versions, not always available on rented web space (LunarPages for example uses 5.4.34 as laravel requires at least 5.9.*)

To my delight cakePHP has created a virtualbox. I do use xampp but prefer a virtual environment for development. As a windows user this can only bring pro’s.

What I especially like and always liked is your documentation and the fact you can download a pdf for offline use (i actually print them out). This is a problem and often a frustration with laravel users, hence the myriad of questions on Stack Overflow compared to cakePHP. Although all is documented, it is very hard to find (back) what you are looking for, even if you know it’s there ‘somewhere’. It has improved with their online search function, but still.

I have a lot of respect for Taylor Otwell, the top level maintainer and developer of laravel. He is for sure a genius in his field. But his thinking and understanding of laravel goes faster that his explanation of it. The laravel documentation is almost cryptic.

The good thing about learning laravel and ‘stepping back’ to cakePHP is Symfony. Thanks for that! Another thing is, because of the cryptic documentation, I was forced to learn the vendors inner working more than I ever had to do with cakePHP.

Setting up cake is a bit more complicated but as a side effect your framework loads faster: less service providers.

Good job and thank you so much. I’m a fan again and won’t look back.

Dimi

Dimitri on 6/19/15

Dimitri: What would make the setup of CakePHP simpler? I’d like to make it easier if we can.

mark story on 6/19/15

Hey Mark, great job. I love CakePHP. I’m enjoying the new version.
Regarding the migrations, in my view, it messy create tables and create records within the change methods, down and up.
I preferred attributes to create schemes and callbacks methods to registers mockup.

Rafael on 7/14/15

Rafael: Using properties was pretty limiting though as it made expressing changes in state harder. With methods it is much easier to convey the intent of the change. With the property/snapshot approach we had to rely on a machine to generate the changes which got pretty dicey sometimes.

mark story on 7/23/15

I have used CakePHP 2 for quite some time and I’m a pretty old guy so change is hard, but I really like what I’ve seen so far.

I’ve already turned around a couple of small projects in 3. Kudos to the entire team.

Even though the namespace rigor is slowing me down a bit, at least now I can hold my head up high around all my java friends. Also appreciate your acknowledgement that the alternative datasource scenario is a big(ger) challenge now!! I would love to see a simpler non-relational example to use as a template … like a CSV source or something.

Jeff on 7/28/15

Jeff: From the few people I’ve talked to about CSV datasources, they were often using them as shortcut around not creating a database table. My opinion is that if you need to query a CSV file or relate it to database table, you should probably use a database table and not a CSV file.

With that said, I can see the value in having a lightweight loading, parsing, filtering wrapper around CSV files. This would make tasks like data imports easier to build.

mark story on 7/31/15

My first exposure to Cake was version 3.0 so it’s hard for me to compare with previous versions. I do think it’s an excellent framework as its provided me with all of the functionality that my site heroflicks.com has needed and the docs and tutorials are solid. I am most impressed with the public chat available from the cake website. Everytime I’ve gone there the users have been very responsive, kind, and helpful. Cake++

Michael Ferrell on 8/4/15

Online blogs about CakePHP vs ‘Other popular PHP frameworks’ made me think of switching to another framework, but after observing code and structure of CakePHP 3.0 especially the way existing libraries like mobiledetect are leveraged, I am happy that I stayed with Cake. It’s going to be more sweeter in the future. ;-)

Great work CakePHP Team.

Manish Motwani on 9/4/15

Comments are not open at this time.