PHP South Coast 2015

I’ve just arrived back from the inaugural PHP South Coast Conference.  It was a really great event that seemed to go without a hitch, had a fantastic range of speakers and a nice bunch of people that attended.  So first of all, a really big thank you! to PHP Hampshire, BrightonPHP and PHP Dorset for putting on a top-notch event – you really wouldn’t have known it was their first one, everything seemed to professional!

For me it was probably the first conference I really tried to make the effort to talk to complete strangers.  I never do that at conferences!  Not because I don’t like y’all but just because it’s not in my nature to put myself out there like that.  But an over-riding theme of the conference really seemed to be around community, getting out there and talking to people that are part of that community, sharing your knowledge, absorbing theirs.  So that’s what I tried to do.  I have to say that everyone I spoke to was really nice – everyone interacted, everyone was genuine, the speakers were always happy to answer questions and offered email addresses to help out more.  We truly do have an amazing community and I’m happy… no, not just happy.  I’m proud to be a part of it.

So what of the conference itself?  Cal Evans gave the keynote speech and kicked off the the day talking about the community, how he got involved in it, how we can pay back the community in ways that we can get involved (PHP Mentoring, for example).  A number of things reminded me of what coderabbi talked about in his Wisdom as a Service world tour.  Really, if guys like Cal and Yitchok are telling you that community is an import thing then you can be damned sure that it really is!

I then opted to see Rafael Dohms talk about doing Composer the right way.  I also wanted to see Joe Watkins talk about Parallel, but at they were on different tracks and I can’t clone myself just yet…  Thankfully the sessions were all recorded!  Anyway, this talk, shockingly, was about using Composer and he covered proper semantic versioning and how that’s important to use correctly, how you might use that in pull in the correct versions of your dependencies and pitfalls to look out for.  He also gave advice on better ways to use composer – not hacking on the composer.json file, for example (something I’m fairly guilty of but will change my ways!), but instead use the cli because it’s much easier and far less prone to problems, commit your composer.lock file, typically do install rather than update…  Some really good pointers here and well worth watching the video if you use Composer and missed his talk.  Oh, and his slides looked immaculate – a really nice, clean style.

The next talk was one I didn’t think I’d care about.  There was a choice between finding out about CakePHP or WordPress and Backbone.  Now, I used CakePHP quite a number of years ago and at the time really wasn’t that taken with it.  That’s probably a personal choice and I’m sure it’s developed a lot since then, but still, the idea of the talk didn’t grab me.  But the alternative was something about WordPress and Backbone?  Urgh… I use WordPress for this blog and know lots of people invest a huge amount of time and money into it, to great rewards.  But for me it’s always just been something to use as a blog just to be lazy.  So it really was a toss up and I figured the lesser of two evils was the WordPress talk by Jeroen van Diik.

I couldn’t have been more wrong about his talk!

Instead of the “lesser of two evils” I tough it would be, Jeroen gave an example of using the WP-API (the WordPress REST API) within a personal project of his which was a mobile app.  He showed how easy it was to integrate, the steps he had to go through (and through again when they changed how the API worked) and how he combined it with Backbone.js within Titanium to make what he called a ‘pet project’ but what I would called a really polished, professional mobile application which looked great.  It was an eye opener for me personally because I’ve not thought of WP as anything but a blogging platform that’s tried to shoe-horn content management in there over time.  But Jeroen’s app used it as a data store with all the WP added benefits (the inherent sorting, tags, types, etc.) – you wouldn’t have even known he was using WP.  Fascinating!

After lunch (which was very nice) I had another dilemma on which track to see.  On the one hand there was Phil Sturgeon talking about API pain points and on the other was Jenny Wong talking about sharing knowledge and Grant Kemp about using Google Analytics to track various things (in this case, the X-Factor results).  Hmm… Another tough choice!  I went with the two lightening talks because we are doing increasing amounts of GA stuff at work so it seemed slightly more relevant to me right now.  Both talks we good – I think Jenny could probably convince anyone that they should be submitting abstracts to conferences, and Grant really had fun with throwing data around in GA.

Next up for me was Dan Ackroyd talking about doing dependency inject right.  I have to be honest, the room was quite warm, I was quite knackered, so probably didn’t pay enough attention to this one as I should/could have.  He did answer some tricky questions at the end and gave valuable advice, but I’m wondering whether Erika Heidi‘s talk on Vagrant and Ansible would have been better for me (if nothing else it would have been in a cooler room!)

Finally there was Lorna Mitchell‘s talk on “advanced adventures with git”.  For me it really was saving the best ’til last.  Lorna’s set up wasn’t your typical run-of-the-mill, slides on screen kind of talk.  She let the audience decide on where to take it.  People voted on something that wanted to hear and she just went with it, talking about that subject with no pause, no hesitation… Oh, and did I mention she was doing pretty much everything live in a terminal window?  Honestly, there was so much info she was throwing out that I think I need to watch the video just to catch up with it all!  All presented with a really relaxed, easy-going nature.  This was the kind of talk that you didn’t feel you were being talked at, no, no… It was a friendly, adventurous chat about git you were having with Lorna down the pub.  Only, you know, with 300 of your other chums.

And that concluded the sessions but not the fun.  Then there was laser tag and tabletop gaming fun to be had.  I opted for the former and on my last game playing with 19 others I came first.  That’s right, bitches; my old arse pwned you at laser tag. 😉

See you all at PHP South Coast 2016!

Did you like this? Share it:

Phpiwire: a PHP extension (written using Zephir) for controlling the Raspberry Pi GPIO


So it’s been a while since my lightening talk on Zephir and I realized I hadn’t really done anything to try to learn it a little more in-depth.  Coincidentally, I was recently going through a drawer and realized that one of my Raspberry Pi’s was in there just begging to be put to some use (seriously, I could practically hear it weep).  So I thought that the only thing to do was to attempt to write an extension using Zephir so that I could control the GPIO via PHP.  I mean, isn’t it obvious? Continue reading

Did you like this? Share it:

BrightonPHP lightning talk on Zephir

Yesterday I was one of four people to do a lightning talk at BrightonPHP. As anyone who knows me; I hate public speaking with a passion. Anything over, say, four people (usually including me) and I just like to sit there quietly and not say much. But encouraged by @coderabbi’s Wisdom as a Service talk he did at BrightonPHP in February (read: told at the train station by coderabbi that I had to do a talk) and the fact that it was a lightning talk so I didn’t actually have to speak that long, I presented a very brief, high-level overview of Zephir.

If you think any of this is inaccurate, needs tweaking, etc., then please let me know and I’ll happily update it accordingly.

Well done also to Rich, Rowan and Tristan for their very informative talks on joind.in, xml/json and selenium (respectively)…  Although I’m the only one that didn’t get an applause after their talk, so you’re all dead to me. 😛

Did you like this? Share it:

Opache gui update and now on Packagist

I’ve just pushed to github a big overhaul of the opcache gui script. It comes with a sweeping set of changes which also includes using react.js to power some of the interface to really enhance the real-time updates. (OK, it was really just an excuse for me to learn a little about react.js but I think it was worth it!)

I’ve also put the opcache gui and the php error log gui up on packagist – my first packages on there!  Check ’em out:

https://packagist.org/packages/amnuts/opcache-gui
https://packagist.org/packages/amnuts/phperror-gui

Did you like this? Share it:

‘Open in PhpStorm’ context menu for Windows

I’ve just started to use PhpStorm, which is a wonderful IDE. However, I wanted to make it even easier for myself to open files and folders. A context menu in Windows fits the bill quite nicely – just right-click on a folder and open in PhpStorm.

This batch file will do just that!

loading gist file...

Just set the path to whatever suits your system and then right-click and ‘run as administrator’ on the batch file.

Did you like this? Share it:
JWPlayer thumbnail preview generator

Create video thumbnail previews for JW Player


JWPlayer is a fantastic video player for the web. One of the great features it provides is the ability to show thumbnail previews of the video as you slide along the toolbar timeline, much the same way that YouTube and the like allow.

Generating the thumbnail images is not quite so easy unless you have ffmpeg installed and know a bit about the command line options. I got a little frustrated myself having to come up the with the command line magic whenever I needed it, and so the JW Player thumbnail preview generator was born!

It’s a simple command line tool, written in PHP, that allows you to whip up the thumbnails and generate the required VTT file with a command as simple as:

php thumbnails.php -i "/input/video.mp4"

OK, so you still need to have ffmpeg installed on your machine – not much I can do about that one, sorry! – but at least generating the files is now much easier!

You can generate the individual thumbnails or have them coalesced into  sprite sheet, and generate a random poster image. Full instructions are on my GitHub account; so go, fork, improve, and feel free to give any feedback.

Did you like this? Share it:

Effective, clean UI for viewing the PHP error log


Example usage

Recently at work I found myself trawling through the PHP error log file and found that all the lines of text were starting to blur after a while. Thinking there had to be a better way over viewing the log file, and following on from my single-file opcache viewer gui, I decided to knock out something for viewing the error log file as well.

With this single-file error log gui it will only show the error once and then tell you how many times it appears in the log. It will allow you to narrow down your search of errors by being able to hide the different types or sort in different ways, and it will also allow you to search results based on particular file paths.

I’ve pushed the code up to my GitHub account, so please feel free to fork and improve and/or give feedback.

Did you like this? Share it:

Counters in CSS: making a table of contents list

As I’m sure you know, you can create an ordered bullet point list but it has limitations.  For example, if I wanted to have a table of contents so that the numbering goes 1, 1.1, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.3.1 and so on then the standard ordered list just isn’t going to cut it.  Oh, sure, you could reset the numbering on the sub-lists so that it uses roman numerals or something like that but to me that just doesn’t feel quite right…

Enter CSS counters!

Counters offer you a way to increment and decrement a value every time an element has the rule, and there doesn’t have to be one counter – you can have as many as you need,

So using counters can easily produce the correct kind of TOC list that we want. And here’s the jsFiddle to show you just how easy it is.

Did you like this? Share it:

Tweeting on a button press with the Raspberry Pi


A while ago my door bell broke. So I did what any sensible person would; I decided that instead of buying a new one I would hook up an old bell I had to a Raspberry Pi and have the bell ring when someone pushed a button on my door. But then I though, “well, that’s a bit boring.  My doorbell should tweet me, too!”

The long and the short of it is that I couldn’t get the mechanics of the bell ringer to work but had a lot of fun with the tweeting side of things because it involved my first shot at doing some Python code. And the really good news is that it’s ridiculously easy to accomplish.

This was roughly my process…

Continue reading

Did you like this? Share it:
simple-botting-with-php

Book review: Instant simple botting with PHP

I had the chance recently to read the book Instant Simple Botting with PHP, written by Shay Anderson and published by Packt Publishing. The book is designed to be a very quick and easy (hence the title!) introduction in to creating bots to scan web pages and collect information from them.

The book seems squarely aimed at beginners in PHP and object orientated programming so lives up quite well to the “simple” aspect of the title. However, I wouldn’t really say “instant” because there are quite a few pages dedicated to setting up PHP and making sure it works with a simple “Hello world”. My preference would have been just to assume that  someone that wants to know how to create bots probably already has PHP set up and has at least a passing familiarity with it. But as it seems to cater to real beginners I suppose it needs to hand-hold people through the setup.

The code is clear throughout and easy for anyone to understand and follow and by the end of it you’ll have something that will very basically scrape a web page. If you’re a beginner I’d imagine you’d be left with some sense of accomplishment and something pretty simple with which you should be able to tinker without getting too caught up with a tonne of code or complexity. However, if you are any kind of seasoned developer then you will probably find the book too light-weight as there are no advanced techniques are really discussed. But then, what would you expect with just around 60 pages in the book?

However, as I’ve said, the code is nice an clean, the book for what it is is well written, and the author discusses some good practices.  Great for a beginner but probably not enough for a mid/seasoned developer.

Did you like this? Share it: