RSSAmplifier

Blog

PHPScaling on PHP Scaling

Recent content in PHPScaling on PHP Scaling

phpscaling.comRSS feed ↗33 posts

Latest posts

Solving 'WP-CLI Updates Not Found'

Comments? You can comment on this article on my Mastodon post for "Solving 'WP-CLI Updates Not Found'" That's one (slightly annoying) problem solved - I've managed to upgrade the WordPress version and plugins on https://abulman.co.uk/ on the second attempt. I use WP-CLI to do it all from the command line (and then commit all the changes into Git), but when I last tried to update, it had been…

It's All About The Data (part 2)

Comments? You can comment on this post on my Mastodon post for "It's All About The Data" ... What should I use? Objects. There are two reasons. An obvious reason - and then the actual reason that is more subtle - and is the best reason to use objects (pretty much everywhere). Objects use less memory If you only need to deal with a few small, and uncomplicated things - pieces of data - then almost…

It's All About The Data (part 1)

Comments? You can comment on this post on my Mastodon post for "It's All About The Data" ... and arrays aren't great for data In my career so far (now over 20 years programming sites with PHP - half of that with Symfony), I've worked on a number of projects that dealt with a great deal of data - a couple of recent examples include menus for many restaurants and hotels (and each with hundreds of…

BunnyCDN via FlySystem on Symfony

Comments? You can comment on this post on my Mastodon post for "BunnyCDN via FlySystem on Symfony" I've been refactoring the code at work to help move uploaded files off the main server, and also optimise the images when they are used (no need to use a 4000 x 3000px 4.7MB file for a 500px wide thumbnail!). The standard library to upload files to a remote filesystem with PHP is FlySystem, it's been…

Investigating RedisGraph

RedisGraph is now in maintenance mode As of July 5th, 2023 RedisGraph is no longer under active development. You can read more about the end of life of RedisGraph. There is an actively maintained fork of RedisGraph, in the form of FalkorDB. from https://github.com/RedisGraph/RedisGraph Thus far, I've not done anything serious with much more with database like Mysql, some Postgres and on the NoSql…

Speeding up your tests, and also your code coverage!

Slow running tests are a bug - they stop you from doing as much as you can with your code, & its quality. Spend a little time working on making your tests better, clearer, and faster - and you'll reap rewards from your work. I've had a couple of useful improvements in the time spent running my PHPunit tests recently. First was avoiding setting up the database in each test, and using the Alice…

SncRedis and tagged services

In early 2016, I suggested an addition to the SncRedis-bundle. The project itself is an fully-featured add-on ('bundle') for Symfony framework projects to easily do a number of very useful interface functions between Symfony and the Redis database/cache. It can, for example, quickly enable all the sessions to be put into a Redis server, and also cache the Doctrine meta-information as well as…

Improve your code coverage percentage - delete code!

A recent post showed how to setup Code Tombstones - but there are other , even more insidious pieces of code in a project. The code you know you aren't using now, but you wrote ahead of time - because you think it will be useful, or you have plans for it, or any one of a dozen more reasons. Chances are - you might never get back to it, and it's just taking up important space.

PHP-in-London list

While Twitter can be really annoying, sometimes it can help to promote some wonderfully simple ideas. One of these came from Andrew Woods (@awoods) - a github repo called php-in-seattle. It's a simple idea - just a list of companies around a geographical area that use PHP. What it can enable is of mutual advantage to the companies, and developers that might be looking for a new job. So, I started…

Code Tombstones

Version 0.9 of scheb/tombstone autoloads a file with a tombstone() function. See the bottom of the post for a fix to override that in your own code. In a large project - particularly one in a dynamic language like PHP, as a project gets bigger maintaining full control of the code can be difficult. New features are written, old ones are changed or deprecated. Sometimes code is left behind, unneeded…

Replacing @expectedException with $this->expectException()

One of the advantages of a side-project is that you can be a little extra passionate about getting things just right. If you want to increase code coverage because you think that it's good, you can - after all, it's just some time now doing things that you like. So, earlier in the year, when I saw Sebastian Bergmann's article on 'Questioning PHPUnit Best Practices', I added it to a little (well,…

Upgrading PHPunit - fixing PHPUnit_Util_DeprecatedFeature_Logger

Having just watched Sebastian Bergmann's "The State of PHPUnit" presentation from Fosdem 2015, I was inspired to install and test a project of mine with the latest stable PHPUnit - v4.7. It was easily installed on the command line. composer global require "phpunit/phpunit" I installed it as a new, global, tool because in my project I am using the "ibuildings/qa-tools" repository to install and…

Recently....

It's been one of those quiet spots around here for a while, so here's the catch-up on what has been happening while I was not posting. I've recently finished a short contract working with an agency, Transform (part of the Engine group) working with a couple of government departments. The Office Of The Public Guardian receives, checks and stores Lasting Powers of Attorney - a legal document that…

Hire quickly: Addendum, recruiters

Recruiters: Here's the rules. The first recruiter to tell me the company name, and then send the job-spec gets to forward my details - if I think it's interesting. No company name, or spec, no chance If you send my details without my OK, you lose. And I tell the company you are a loser (chances are, they are too). Sending me all the information I could want to know is good - but when you do it on…

Hire quickly, because your competitors will.

If you aren't taking hiring seriously - other people can, and do hire the people you need. I've been guilty of it before - leaving it a couple of days - or even a week before getting back to someone that sent in their CV - although of course, most of the time, it didn't matter. The person wasn't going to get hired because they were just not good enough (the generally poor quality of developers is…

Jailbreaking your Kindle, and putting new 'screensaver' images

A quick fun post for those of you with an Amazon Kindle - some instructions on how to a) jailbreak your reader (trivially easy), and then b) put your own wallpapers on there, so you get a more interesting 'screensaver'. It's really easy, no more than 20 mins and a couple of reboots/software updates. Most of the time is literally waiting for the reader to restart after you've placed a file in the…

Booze at tech meetups

I was out last night at the The Big Xmas [bash] #, near Silicon Roundabout. It was a fun night out meeting various people, tech, business and recruiters. Oh, the shame though - I was wearing the same T-shirt as someone else - and, yes, I have indeed replaced people with small shell scripts. Now, to the main part of what this post is about - the rant. It's not aimed at the particular event last…

Deployment with Capistrano - the Gotchas

Capistrano, makes deployment of code easy. If you need to do a number of additional steps as well, then the fact that they can be scripted and run automatically is a huge win. If you've only got a single machine (or maybe two), then you could certainly write your own quite simple, and entirely workable system - I described something just like this in a previous post: "SVN checkouts vs exports for…

Back from the coalface

I've been pretty busy in the last couple of years, first at Binweevils and in 2011, PeerIndex - hence the utter lack of posts, but as the note on my personal CV site says, I'm taking some time off between looking for my next role. This does give the opportunity to write more of PHP Scaling and the tools around development that I've been using in the last couple of years, and that have been piquing…

Doing the work elsewhere - Adding a job to the queue

I've previously shown you why you may want to put some tasks through a queuing system, what sort of jobs you could define, plus how to keep a worker process running for as long as you would like (but still be mindful of problems that happen). In this post, I'll show you how to put the messages into the queue, and we'll also make a start on reading them back out.

Doing the work elsewhere - Sidebar - running the worker

I'm taking a slight diversion now, to show you how the main worker processor runs. There are two parts to it - the actual worker, written in PHP, and the script that keeps running it. For testing with return from the worker, we'll just return a random number. In order to avoid returning a normally used exit value, I've picked a few numbers for our controls, up around the 100 range.

Doing the work elsewhere - Asynchronous Message Queues

The use of Beanstalkd as a queueing system What is an asynchronous queue The classic wikipedia quote (Message queue) In computer science, message queues and mailboxes are software-engineering components used for interprocess communication, or for inter-thread communication within the same process. They use a queue for messaging - the passing of control or of content. Group communication systems…

($me instanceOf ZCE) === true

Phew. That would have been embarrassing if I'd not passed my ZCE on Thursday afternoon (Jun 4th, 2009).

Upcoming posts - keep watching

Just a quick note on what is going to be posted in the next few weeks – I've got a few significant pieces in mind for various topics – including: Doing the work elsewhere – asynchronous queues This is going to be a series of articles – and to support it, I'm rewriting some code that I had originally wrote for my last job (v2, and so significantly improved over the original).

I laugh at your ZCE exam prep tests #2

Back at the PHP London Conference at the end of February, iBuildings was offering a little test, with prize for people that could do well answering the sort of questions that are on the ZCE exam. Never one to turn down something useful for free, I took ten minutes to answer the eight questions. A few weeks later, I get an email from them/Zend to say I'd won the chance to take an exam – ZCE, or ZFE…

Riddled me that

Well go figure. I’ve just won $50 (Canadian, that’s about $3000 USD by now) of books and ‘stuff’ from PHP Arch, care of its publisher, Marco Tabini's, blog. He’d put a little puzzle up last night, some long numbers, and a few short. I recognised them as almost ISBNs – it wasn’t hard to figure them as having dropped a zero from the front, making them “php|architect’s Guide to Programming with Zend…

Always have up to date documentation, part #2

see my previous post on the topic, #1. My last post ended up more as a how-to than what-to. This time, I'll say why you should have local copies of the documentation for most of the tools you use. I'll also tell you the sort of things I always have handy as well. Getting a local copy of php.net - and getting installed as an apache vhost and updated (probably weekly) is some effort, but well worth…

Know thy tools first of all

When you have a library, like PEAR or Zend Framework – or even just the whole PHP language library – it’s absolutely vital you know what it can do. What you don’t know can cost you weeks of effort and pain. I found this out (again) today, but it’s not my pain – it’s an employee who was too busy deciding that the Zend Framework wasn’t suitable for a simple cron-script task, he has spent most of the…

Always have up to date documentation, part #1

As I mentioned in my second post, ZCE prep – and dumb tests - about open book tests (like Brainbench), having a copy of all the relevant documentation can be incredibly useful, if only from a speed issue. Knowing you can just open a new tab and type a few words to get the information on a function, or concept from the manual takes away so many problems. I mentioned there that I have a local copy…

ZCE prep - practice test #1

Well, I've just completed the PHP Arch 'Vulcan' practice test – the first of up to five such practice tests I've purchased. I have quite deliberately not gone through what study materials I have on hand before I took this test (I wanted to get a baseline), but none the less got an 'EXCELLENT' final score, and the same 'Excellent' on seven of the twelve sections the pre-test is broken down into.

A useful idea for helping to enforce PHP code standards

A more recent tool to use I'd suggest using phpcsfixer with one of the default coding standards - PSR-12/PER-Coding-style or @Symfony. Extending PHP_CodeSniffer by Raphael Stolt shows how to quite easily add to a tool that will report what parts of your PHP source needs a clean-up, from the built in 'sniffs' for coding standards, and now adding to that for some slightly more opinionated choices on…

ZCE prep - and dumb tests

This week I'm going to take the first of my PHPArch.com's ZCE prep test – then I'll read the book and see they they expect me to know. Going for the Zend Certification is something I've been thinking of doing for a couple of years, and especially now that it covers PHP5 – and increasingly good practices and security topics. It's not that I need to get the ZCE, I'd go for it , for the intellectual…

svn checkouts vs exports for live versions

I've read http://www.svn-checkout.co.uk/2008/01/19/how-to-release-new-versions-of-websites/ via http://www.lornajane.net/posts/2008/SVN-Deployment-and-a-New-Site and while I consider revision control an essential tool (a few years ago, my job was the only one in the previous five years where I didn't have to install my own RCS), I somewhat disagree on the idea they suggest. That first link, 'how…