I work with a lot of APIs and I really appreciate good tools. Lately I've been really enjoying using Runscope for testing and monitoring my APIs so I thought I'd share how I work with this tool, which has a great one-person free tier *and* the ability to import/export tests so if you need to work with a team with just the free tier (the examples here are from an open source project which is an obvious use case where it's hard to fund tools), it's clunky but doable. The idea here is just to show you around how to create your own API tests with Runscope (and also to write down what I did so I can point both my future self and others at this!) Continue reading
I recently tweeted this:
If your project installation instructions recommend requiring dev-master in composer, I may need to reconsider my choice of package
— Lorna Mitchell (@lornajane) December 2, 2015
I got a few responses asking me to expand so I thought I would take the opportunity to write more than 140 characters on this topic. Continue reading
Database patching is a wicked hard problem, one that's got a bit easier in my world lately as I've been using Phinx on a few projects. I like Phinx because it avoids the numbered-patches problem by using date stamps as part of its patch naming and it is pretty smart about creating the correct forward and backward changesets from a single
One thing I didn't immediately find was how to insert data. Continue reading
Phan is the PHP Analyzer for PHP 7 code. I've been using it, partly out of curiosity, and partly to look at what the implications of upgrading my various projects will be. The simplest usage instructions are:
phan -f filelist.txt
I generated my
filelist.txt files with a little help from grep - by looking for all files with opening PHP tags in, and putting that list of filenames into a file. My command looks like this:
grep -R -l "<?php" * > filelist.txt
This simply greps recursively (the
-R switch) in all files looking for
<?php and when it finds it, outputs only the filename (the
-l switch does that bit). Then I just put all the output into my
Phan is in its early stages but it's ready for you to run on your own projects. Look out that you may need to put your bootstrap or other include files first in the
filelist.txt file if phan isn't finding things in the right order - luckily with it all in one file, it's relatively easy to move things around if you need to.
One of my git repositories has developed a tendency to refuse to checkout a feature branch locally that exists on the remote repo. My git bash completion works, but then strange things happen! It turned out to be that I had two remotes with the same refspec, so I thought I'd write down the behaviour I saw and hopefully help someone else to fix this problem faster if they see it. Continue reading
I'm an open source project maintainer, working on the projects associated with joind.in, and recently we added a Code of Conduct to all our projects (we have quite a few as you can see from our github organisation page https://github.com/joindin).
I feel the same way about codes of conduct for open source projects as I do about codes of conduct for events. You can absolutely run a totally safe and effective event without one, but by having one you make very clear what your expectations are - and in turn this manages the expectations of the people attending that event. Continue reading
PHP has subtly changed the wording of this error between various versions of the language, which can trip up your log aggregators when you upgrade so I thought I'd give a quick rundown of the changes around the "call to member function on non-object" error in PHP, up to and including PHP 7 which has an entirely new error handling approach. Continue reading
It's Ada Lovelace day, a day when we celebrate women in technology. This year I'd like to mention a group of people who make the biggest difference in the tech life of any minority: the allies. Continue reading
I'm very excited to announce that some of my content is featured in the PHP Learning Path from O'Reilly. The Learning Paths are a good way to buy a bundle of content from different people on related topics, and the introductory pricing is always a good deal! Their newest offering is the PHP Learning Path, which has a video course on PHP and MySQL, my intermediate PHP Video course (they wouldn't let me call it "all the things Lorna thinks PHP developers need to know" unfortunately!) and also my video course Git for Web Developers which has a bunch of PHP in it as well as my best git tips and tricks.
I think it's a pretty well-rounded collection and it's only $99 for a couple of weeks, so get the PHP Learning Path here and let me know what you think?
Not the catchiest name for an operator, but PHP 7 brings in the rather handy null coalesce so I thought I'd share an example.
In PHP 5, we already have a ternary operator, which tests a value, and then returns the second element if that returns true and the third if it doesn't:
echo $count ? $count : 10; // outputs 10