Use Database Connection Strings with Laravel 8

I’ve been doing a lot of database stuff lately, and not much PHP, so when I returned to make my first Laravel project for a while, I had to check the docs to remind myself how some of this works. I noticed that the default approach to database credentials is still to use separate credentials for the host, port, and other variables. I’m using Aiven databases (because I work there and managed databases are great for demo apps as well as real ones!) which supply connection strings, but Laravel supports these too. Continue reading

Handy Beanstalkd Admin Console

I’ve been building apps with queues lately and mostly using beanstalkd as my queue because it is very simple, very fast and on my platform it is [apt install beanstalkd] -easy to install. I have also been using a handy web interface for beanstalkd which I like so much that I felt I ought to share! It’s beanstalk-console, which is a PHP-based web interface to one (or many) beanstalkd servers. Continue reading

HTTP Toolbox

As Web Developers, we need to know how to work with HTTP from every angle. I gave a 2-hour tutorial at PHP UK that included some of my most trusted tools – but it was sold out and a bunch of people asked me if there was video (there wasn’t, tutorials make little sense when videoed). Instead, I thought I’d try to set out a self-study version of the workshop (I rarely teach these days so I’m unlikely to deliver it anywhere else).

There’s a slide deck, some exercises and a sample repo on GitHub … let’s dive in! Continue reading

PHP Learning Path from O’Reilly

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?

PHP Quick Stack Trace in Exception Handler

PHP and frameworks built from it have many great tools to assist with debugging (I particularly like XDebug) but sometimes you can find yourself in a situation where the “helper” features aren’t all that much help … in my case this was a framework totally determined to output HTML from my commandline script and to only show me 5 lines of stack trace, which wasn’t enough for my complex application. I had to look up how to generate a nice stack trace inside an exception handler so here it is in case I want it again some time (future me, you’re welcome!) Continue reading

How to Choose PHP Hosting

I’ve been thinking a lot about the state of hosting in PHP lately, mostly as a result of working with a few different clients on their setups (including one that bought brand new hosting a month ago and got a PHP 5.3.3 platform), and also being at DrupalCon and meeting a community who is about to make a big change to their minimum requirements. With that in mind, here are my thoughts and tips on choosing hosting. Continue reading

Compiling PHP Extensions

There are lots of reasons why you might like to compile your own PHP extensions. For me those reasons are usually:

  • The extension isn’t available on pecl (e.g. uprofiler)
  • The extension is on pecl, but you need the newest version or a branch with a particular feature or fix in it, perhaps for testing
  • You are fixing an extension yourself (yay, we need more people like you!)

Related: If you followed my previous post on compiling PHP, be aware that in the php/bin/ folder there is a pecl binary that will install extensions correctly for whichever version of PHP it belongs to, so you may not need to read the rest of this post. However if you do, the paths follow on from the examples in that post.

I haven’t seen a really approachable guide anywhere, we tend to speak of extensions in hushed tones, and actually it isn’t particularly tricky so here is my quick how-to guide. Continue reading

Running Multiple Versions of PHP

When I advise people about upgrading their PHP version, I say things like “just run your test suite with the new version” “just grab the new version and try your site with the built-in webserver”. A couple of people recently have asked for more detail on how to actually achieve these things so here’s a quick primer on getting new PHP without touching anything to do with your existing PHP installation. Continue reading

New PHP Videos on OReilly.com

I am delighted to announce that I have new video titles available! I’m delighted for two reasons: selfishly, because these things take a lot of prep and I am pleased they are done; but also because I think it is very good news that a key industry player such as O’Reilly recognises PHP’s place in the world and works hard to publish new content in this area.

There are two videos available: PHP Web Services and Intermediate PHP (subtitle: a bunch of things Lorna thinks will make developers’ lives and applications better!), you can click through (disclaimer: affiliate links!) to get more information and a detailed chapter outline for each course. I hope that either or both of them will be useful to you. Continue reading