Integration testing with external webservices, has historically been an uncomforable process in PHP for me. It frequently involves complicated mocking that was fragile and hard to maintain. I’ve long wished for a PHP library that was as simple to use as HTTPretty is in Python.
Things tagged with Open Source
Open Source Software
In my daily work, I end up having to
ssh into a variety of hosts. Keeping track of which terminal is on which host can become challenging when I have 3 or 4 terminals all at a
mysql prompt, or tailing log files. A co-worker of mine came up with a pretty clever solution that I wanted to share. The clever solution involves some bash, and Applescript (as we’re working off of OSX).
I’m excited to announce the availability of a PSR7 Bridge plugin for CakePHP. This plugin lets you bridge PSR7 Middleware with CakePHP 3.3+ applications.
I’m always looking for new challenges. With my background mostly being in web development, I have little to no experience in low-level languages. In the past I’ve tinkered with C, and go-lang. This summer, I decided to try and learn Rust. Rust aims to be a very safe and performant systems-level language.
For a number of years, I’ve developed the AssetCompress CakePHP plugin. Simultaneously, I’ve maintained similar code at FreshBooks.
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.
I recently finished upgrading this site to CakePHP 3.0.0-dev from 2.5.5. I thought I’d share my experiences, as they might be helpful to other people attempting to update a CakePHP 2.x application to 3.0.
In terms of scale & size, this site is pretty small and simple. It has a mere 12 tables, and ~5000 lines of code including HTML, and uses 3 plugins.
Earlier today, I packaged up AssetCompress 0.17. This release has a few noteworthy features.
Cached builds in development
Historically, in development every build file would be rebuilt on every request even if the source files did not change. While this works OK if you have a few build targets, it can get pretty slow if you have many build targets, big build targets or use a pre-processor like sass. As of 0.
A few weeks back during CakeFest 2014, I had the opportunity to hunker down and get DebugKit upgraded to CakePHP 3.0. While it was less of an upgrade and more of a re-design and re-write, I think the end results justify the drastic approach I took. First, a few of the problems I was trying to solve in the new version:
1. It is hard to make DebugKit look great as it lives on the same page as your app.
There will be a number of backwards compatibility (BC) breaks in the CakePHP 3.0.0 release. I thought it might be helpful to go over some of the reasons breaks in compatibility have been made. Each time we’ve had to break compatibility with 2.x we’ve done so because the existing behaviour fell into a few categories of problems. I’ll go over a few of the bigger categories in detail.
I recently read write code every day by John Resig. I’ve been trying to follow a similar set of ideas for a while now. My rules were less restrictive than John’s were.
I recently had the opportunity to speak at PHP Conference Argentina . I’d like to thank Mariano and the other organizers for having me at the event. It was a fantastic opportunity for me to visit Buenos Aires, connect with some friends old and new, and give a new talk about my experiences working on CakePHP.
In a previous post, I outlined some changes that would be coming for configuration in CakePHP 3.0. I’ve recently been thinking a great deal about configuration as well as building some prototype applications. I’ve come to the conclusion that configuration needed to change. Coupling all the classes to
Configure while convenient and simple, had a big drawback.
The events system has become an integral part of CakePHP since its introduction in 2.1. When originally introduced, we needed to make a number of compromises in the implementation to facilitate compatibility with the code it was replacing. For 3.0, I wanted to revisit the event subsystem and try to make things more efficient and streamline the API a bit.
I try to keep fairly busy. Between work, being a dad, and working on existing open source projects, I found time to work on two new ones.
Profiling is a very interesting topic for me. I love spending time sifting through results trying to find ways to make code run faster or use less memory. XHProf is a C-extension created by Facebook.
I really like how composer simplifies dependency management & installation. It can make applications more portable, and simpler to deploy when compared to the pear installer. Another really nice feature of composer is that you can easily install any pear package, making it perfect for installing CakePHP. While installation was simple, some extra work was required to get things up and running smoothly.
Making sure your freshly released CakePHP plugin still passes all of its tests can be a bit of a time sink. Setting up Jenkins for small project can be a big job. After I setup Jenkins once or twice, I personally longed for a simple way to get continuous integration with not much work.
For 3.0 the team and I are re-visiting how we’ll recommend installing CakePHP, and as always I wanted to try to provide context on what my thoughts are, and get some feedback on the plans.
Background & context
CakePHP is currently availiable in a few different ways. Generally people either download zip files, or clone the repository. Both of these methods provide a quick easy way to get started.
Early work has started for CakePHP 3.0, and I’ve started re-visiting how CakePHP handles configuration and bootstrapping. I want to focus on configuration for this post, as bootstrapping, while related is worthy of its own post. The goal of this post is to provide some context on the planned changes, and to get feedback on those changes. My hope is that by getting feedback early on we can avoid problems & surprises later on.
Slides from a talk I gave at CakeFest 2012