5 Of The Most Useful WordPress CLI Commands

Over the past couple of years I’ve gotten more involved with WordPress site management. One of the tools I seem to find very useful is the WordPress CLI.

WordPress CLI is a command line interface for interacting with a WordPress site.

Below is a small list of the commands I use most frequently.

WordPress logo primarily for presentation purposes.

Plugin updates

First up is a really quick command to run all plugin updates. I find this to be a pretty reliable and easy way of just running updates for all plugins in the repository. Due to the locked down nature of WordPress and the reliance of paid for plugins this command may not get all update but it does work with the vast majority of them.

Theme updates

As above this command is very easy and quick to just run any pending theme updates required on a site.

Core updates

Although updating Core in WordPress can be quick in the cms, I find running this alongside the above 2 commands is good practice and can be quite speedy.

Translation updates

This is one that often catches me out when running updates and pulling translations into the language folder. This is another 3 quick commands to just get it done.

Update User Information

Quickly running a password reset on a local or staging environment is something I do frequently. I find this command to be a quick and simple way of doing this.

There you have it, 5 of the most useful commands from the WordPress CLI. Often I am running plugin updates or making tweaks to users but let me know what your favourites are in the comments.

The best way to develop PHP websites locally on MacOS

Over the past few years I’ve been on a quest to find my perfect Local Development stack. I finally found it!

Introduction

When you look into the grand scheme of things, web development is still a fairly new industry. It’s only been a consumer thing for a few decades and we are very much in an age where things are moving rapidly. For web developers you could argue that it’s gotten easier to build a website over time. However the tools we use and newer workflows seems to have made things much more complicated.

I’ve been working as a developer professionally now for over 8 years and there have been a whole host of new frameworks tools and evolutions within that space of time. Over the past year or so I’ve been looking into making my development workflow simpler and leaner. During this time I’ve experimented with a number of different solutions. Rather than keep those to myself I thought I’d share my experience with each one and weigh up the pros and cons.

Before I start a little disclaimer

Before I get down to the nitty gritty of what I’ve used, new tools come out each day along with new ways of working. Over the past year or so I have been trying to find something that fits in with my personal workflow and provides the best support for the tooling I require on my day to day basis. This is just my opinion and I’m keen to hear your thoughts and favourite tools in the comments below.

AMPPS

A few years ago AMPPS was my go to piece of software for developing locally. It had a web based UI akin to XAMPP and MAMP and was rather customisable. It had support for a number of different PHP versions and had the ability to easily configure and switch between them on a site by site basis.

What I really liked about it was its ability to configure PHP and over time I began feel familiar and confident with it.

Starting in around 2018 – 2019 however AMPPS has been very slow in getting updates out to support some of the more recent versions of MacOS. Currently the app is not working on MacOS Big Sur with forum posts going back to last July requesting support for it. It currently only supports PHP 7.3 with no easy way of allowing other PHP versions to be installed. We have a number of sites which use different versions of PHP so this doesn’t well work for us.

MAMP / MAMP Pro

Back in the day when I first got into Web Development MAMP was a pretty popular tool. It leans heavily on simplicity and allowed you to get local sites up and running in a few minutes.

It had a user friendly dashboard and allowed you to do handy things like switch PHP and Database Versions pretty quickly.

I recently gave this a go earlier in the year and found myself feeling a little disappointed with it. The app and database kept crashing on my 13″ 2017 MBP to a point where I had 5 in one day. Rather than mess around and spend a few hours trying to get to the root cause of the issue, I got my refund for my MAMP Pro License and proceeded to find another alternative.

Brew Packages

After the issues I encountered with AMPPS I decided to take a look at just installing native brew packages on my Mac. This is perhaps the most customisable way of setting up a development environment. You have fine grain control over every piece of software in the stack and can upgrade and change them however you see fit. This guide written by the guys over at Grav is one of the most comprehensive and recommended ways of getting it setup.

One of my biggest gripes with this method however is just how involved and long winded the setup process can be. Setting up new sites can be a bit more difficult than other process’ too and you need to have some basic knowledge of apache in order to do it. It is however a great learning experience for new people to web development but for more junior developers, it feels quite involved.

For someone with more experience though I think this is one of the goto ways of running PHP sites on localhost. It’s fast, customisable and ticks a large number of boxes for development.

DDEV

DDEV is currently I am using to develop locally. I’ve been using it now for around 4 months or so and I have to say, I’m extremely impressed with it. DDEV ships with all of the tools you would need to develop websites right out the box. Difficult things like SSL Certificates, Mailcatchers and PHP Version Switching is all taken care of within its ecosystem.

DDEV projects need 4 questions initially before a site can be setup with it. Behind the scenes it creates sites within docker containers and uses a CLI tool with a very readable set of commands that just make sense. The one major downside of this tool over the other methods in this list is that Docker containers are obviously slower vs running it on physical hardware and tend to eat a lot more memory. Overall though for me, those two downsides are massively outweighed by just how easy DDEV is to get up and running and how customisable it is.

How WP Rocket improved my page performance

In this article I discuss my experience with the popular “WP Rocket” plugin. How it improved performance and whether it is worth the $49 price tag.

Introduction

During the past year and a half of working with WordPress websites I have encountered a large number of sites with performance issues. By my experience, larger WordPress sites are notoriously difficult to get good performance scores. This is down the nature of its table structures and some poorly optimised third party code. For a while we struggled to improve Page Insights speeds, that was until we discovered WP Rocket. At first I was a little skeptical, why would adding yet another plugin improve page performance.

What can you expect from the plugin?

After installing the plugin on one of our sites and only spending around 30 minutes tweaking the settings, the page insight score increased by almost 40%. WP Rocket has all the bells and whistles you’d expect: caching policies, gzip compression, cache reloading and more. The majority of which come preconfigured out of the box.

Alongside a list of basic features WP Rocket has a few extra separate services. These are a CDN and Imagify for image compression. These are directly built into the existing plugin making them extremely easy to setup.

How much is it and is it worth it?

A license for a single Website in WP Rocket costs just $49 / year for updates. In my opinion the amount of time this plugin saves, makes it worth the money.

Performance and Core Web Vitals

It’s important that performance issues are addressed as search engines nowadays are penalising websites for it. Google and other search providers are consistently changing the rules behind it and with recent changes to Core Web Vitals, performance is becoming more and more important.

To Conclude

Overall the benefit of WP Rocket is not only to improve your page speed but make it easy to do so. There are a vast array of configurable options making WP Rocket is fast to configure and greatly improves performance. WP Rocket isn’t an instant fix and a surefire way to score 100% every time but it is definitely a step in the right direction.

Conventional Commits – Adding meaning to your git commit messages

Recently I saw came across a link to a git specification known as “Conventional Commits”. I’ll discuss my opinions of it in this short post.

What is it?

Recently I saw came across a link to a git specification known as “Conventional Commits”.

A specification for adding human and machine readable meaning to commit messages

https://www.conventionalcommits.org/en/v1.0.0/

Upon taking a glance through the specification I liked the idea for having commits store more useful information. We’ve all seen git commit messages like “a fix” or “fixes bug” but they vaguely tell you what is in it. This lacks detail about why the change was made though.

Structuring Conventional Commits?

The conventional commits specification aims to improve this by providing a simple set of rules to commit messages that explain what changed. When looking through a repository, you often can see a list of vague commit messages. These state what has changed but not why they have and what it means to other users.

You can find an example of the basic structure for a conventional commit below. In short you should have a type of commit fix or feat (but these are optional) which correlate to Patch and Minor changes in Semantic Versioning (Semver). Then an optional scope which “MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):”.

The short description covers a change that has been made e.g. “array parsing issue when multiple spaces were contained in string.”.

Describing the change in the optional body part of a conventional commit is where is see the key benefit. Putting a reason for making the change is extremely useful when collaborating on a project.

So this is all great but where else are conventional commit messages useful?

Why use them?

Ultimately the thing that still excites me about being a developer is the satisfaction with automating a task.

One of the best uses I have found for Conventional Commits is with this PHP Library: https://github.com/marcocesarato/php-conventional-changelog

Essentially this library will go through your git repository and build up a changelog based on the conventional commits. The library can handle things like automatically bumping your version numbers and generating a dynamic changelog. Paired with tools like Github actions and gitlab pipelines this is incredibly useful to automate releases of your libraries. The best part about the Conventional Commit workflow is it’s ability to support automation of various tasks.

I am currently using it for a plugin I recently built in Craft. So far it has helped me save a bunch of time keeping my changelog up to date and managing my releases.

What do you think about conventional commits, how do you manage your repositories and versioning. Drop a comment below to let me know, I’d love to hear and discuss other approaches so we can all learn from each other.

Moving from a Mac to Windows to Linux and back again

After my macbook pro started to age, I tried a Windows Laptop instead. I talk about how I got on what made me switch back to a Mac.

In 2015 I saved up enough to buy my first Mac. After using it for around 5 years for development and side projects I looked at getting a Windows Laptop with a bit more power and dedicated graphics.

I did a bit of research and settled on Purchasing a 2020 Huawei MateBook 13. I’d heard a lot of good things about the build quality, portability and power behind it.

This laptop seemed well for me at first, especially with some of the tasks that needs a bit more power. In terms of side projects though I did find Windows a bit more tricky to work on with more complicated setup for usual software and trying to get a grip on WSL.

Moving to Linux

Photo by Sai Kiran Anagani on Unsplash

I decided to try installing a few linux distributions onto my laptop since it had been a while since I last used it and with me managing a lot of Ubuntu Servers over the past few years, it seemed like something I’d like to try.

This is where a big issue for me with Linux OS’ seemed to occur. I encountered a pretty bad screen tearing issue when watching videos. I spent around 2 – 3 days looking up different commands and running things to attempt to repair the issues with screen tearing. None of the articles I came across really worked out for me, I tried Pop!_OS and Manjaro but the same issue was happening.

I can see the benefits and why so many people are opting to use Linux now. I had everything setup the way I wanted it, the customisation was second to none but in the end the screen tearing just got to me a little too much. Ultimately with a young family I want to sit down for an hour or so at a time and just get going quickly.

Over to Windows

In the end I decided to move back to Windows. At this point I discovered WSL (Windows Subsystem for Linux) and gave Ubuntu another shot through this. After a few days I got my environment configured the way I liked it and things seemed ok.

After a few months of using this one of the main issues I couldn’t help but notice was the drain on my Laptop battery. Occasionally I like to do some work with Docker containers which obviously requires WSL. Effectively this means you are running a Docker VM inside a WSL VM. Essentially when doing this kind of workload, I’d have to charge the Laptop every night.

One of the other minor issues I couldn’t get over was just the quality of the trackpad and keyboard. As far as devices go, I don’t think it was that bad but I do feel like once you get used to a Mac Trackpad, it’s hard to go back to a different machine.

Back in Mac

So after having the above two issues with Windows I decided to dust off my old 2015 MacBook Pro, give it a format for a fresh start and begin saving for an M1 MacBook Pro. I’ll be putting together a post over the next week or so detailing my current development workflow.

What are your experiences of various operating systems? Which one are you using right now and how are you finding it? I’d love to hear about it, leave a comment below.

Setting up MailHog on Mac and configuring to run with PHP

Introduction

Whilst developing a website it’s nice to have that extra piece of mind that emails won’t be sent out to clients or customers. I think a perfect tool for doing this is MailHog.

In a previous article I spoke about getting Mailcatcher setup which is another alternative to Mailhog. The functionality you get out of it is pretty much identical however people may prefer one over the other.

Installing MailHog

In these instructions I am assuming you already have PHP and brew installed on your mac. If you don’t you can follow this comprehensive guide to get them both installed.

Once that has been done already you can run the following commands:

These update the package list for brew, install the MailHog too and set it up to run.

Once done, visit this url to check it’s working: http://0.0.0.0:8025/

Setup MHSendmail ready to use with PHP

Next we need to install a tool known as mhsendmail. This is a dropin replacement for the sendmail command in PHP and makes the setup of Mailhog much smoother.

First off mhsendmail tool is built on top of go so if you don’t already have it installed you can install it with the below command or download it manually from these instructions:

Then get the package for mhsendmail using a go get command:

Setup sendmail path

In order to link the mhsendmail command to PHP we need to locate our php.ini file. If you have installed PHP using brew the path will be:

If this is not the case you can locate it using the following command:

After which you should see the following output containing the path to PHP’s ini file:

Once you have found the file you can edit it with your command line text editor (I prefer vi however other options are available).

Find the line for sendmail path (it likely will be commented out if you haven’t touched it before) and edit it to point the following:

Once you have done this be sure to restart PHP using the following command:

You can copy and paste the below PHP script to see whether or not it is working:

You can then run the script from the command line:

After doing that you should then be able to see the email in mailhog at this url: http://0.0.0.0:8025/

Setup mailhog to start on boot

When starting up my mac I like to know that all services I need are booted up and working correctly. In order to setup booting software on startup you can use the following command to link mailhog into it.

Whilst doing this I did encounter the following issue:

In order to resolve this, you can do the following:

Conclusion

After following the above steps you should now have Mailhog working within PHP on your local environment. Feel free to reach out with any questions in the comments and I’ll do my best to help.

PHP CMS’ and which is right for your developer

This article aims to help you in picking which PHP CMS to use for your next project, with advantages and disadvantages to various options.

Introduction

Which Framework or CMS should I use? This is often one of most difficult and controversial decisions to make before you start building a website. This decision after all will affect you for the next few years and picking incorrectly can have huge consequences.

Throughout my career in web development I have come across and used a number of different PHP frameworks and CMS’. As you use them more and more, you build up an understanding of which jobs they are most suited for. In turn this allows you to be able to see which areas they might struggle.

The goal of this article is to describe my experiences of these different frameworks. From this you will hopefully be able to weigh up which one is most suited for a particular job. As a PHP Developer I only have experience working in smaller Web Agencies so I can’t speak for larger ones and in house teams.

Which Frameworks are we comparing?

Whilst writing this article I can only really comment on the frameworks I have used in the past to build sites these are as follows:

  • WordPress
  • Drupal (7 and 8)
  • Craft CMS

WordPress

WordPress backend interface

WordPress Photo from Unsplash (Stephen Phillips – Hostreviews.co.uk)

Let’s start with WordPress, one of the most well known CMS’ around at one point. According to W3 Techs, a company that specialise in Web Technology Surveys, WordPress’ market share of the internet is around 40%.

WordPress’ Advantages

WordPress’ popularity often makes it a go to choice for people wanting a CMS. It is a well known CMS, with plenty of articles and support forums to get help from. These advantages can make it easier to sell to clients. Due to this fact, WordPress has a comprehensive plugin store and vast array of different themes and starter templates.

Another advantage of WordPress is a user friendly admin experience, making it easy for new users to pick up.

WordPress’ Disadvantages

These advantages however do not make WordPress the ideal tool for every client. Whilst WordPress gives you a vast amount of features with the help of plugins, sometimes customers would more bespoke customisation options. This in my opinion is where WordPress is a little lacking when compared to other solutions.

Usually when building a new feature on a WordPress site, you can often find a plugin which will take you 90% of the way to what you need. If you are happy to work around these limitations or compromise on them, WordPress is a great choice. Getting that extra 10% right however is often where some of the fundamental issues of WordPress can occur. WordPress has this reputation where everything is very fast to develop and easy to use. Personally whilst using it for the past year or so I have seen times where this just isn’t the case. Especially when compared to newer CMS’ and frameworks on the market.

The way people perceive WordPress can be another key disadvantage. I think there is this thought that WordPress is easy to learn and build a site with. Whilst I find this partially true in order to build one that performs well, like anything it takes time. I’ve always found it tricky to get good performance scores on WordPress sites, unless it’s rather simple. This is because the more plugins and features you pack into the site, the slower it becomes. Sites only grow overtime adding more features and functions. Keeping this under control with WordPress is difficult as plugins are usually the only feasible way to get extra functionality quickly. You should therefore take the time to consider every change you make and be conservative with what you are doing.

WordPress’ Summary

So what type of project is WordPress good for? Well as I touched on above I can see WordPress being great for blogs or company brochure sites. Whilst other sites can be creating using tools like WooCommerce, I often find these sites suffer performance issues and are tricky to get right. E-Commerce sites often require large, customised features that I think are implemented better using more focused feature sets.

WordPress can be a good tool if your client is focused on key functionality but is open to accept a few compromises.

Whilst WordPress is customisable, it lacks some key features when compared to other CMS. This lack of features often makes it harder and more time consuming to develop bespoke functionality for.

Drupal

Drupal Backend Admin Interface
Drupal admin area

Drupal is the framework which I have most experience with. At first there were a few things that I found awkward and difficult. This is commonly referred to in the community as “the Drupal learning cliff”. Its approach and target audience is slightly different to WordPress’ in my opinion. It’s more aimed at site builders and has a large number of tools to support the structure and pages for a website.

The community is more aimed at being fully open sourced and you will very rarely if not ever, come across a module which the developer charges for.

Drupals Advantages

As a developer looking at Drupal I think it’s more of a framework with a CMS integrated. This is perhaps the biggest difference between it and WordPress. You have a greater number of available API’s when compared to WordPress to assist developers in doing common tasks. A few examples of these are giving more control over frontend registration, registering new tables (or entities) and giving you the ability to setup new fields to allow you to build a site of any type without any extra modules or plugins.

Another key advantage is the open source nature of its module system. This promotes a community where new features and bug fixes can be submitted by anyone. Meaning that code isn’t abstracted away or has that reliance on another company to support it.

Drupals Disadvantages

The main disadvantage I found was its learning curve. After spending a fair amount of time with it I think there are still things which confuse me about it. I found that it caused me issues whilst theming a particular element. It can be difficult, confusing and feel like Drupal can get in the way of this since you always need to conform to its standards.

Due to this it can be rather complicated and I have often found certain aspects of its theming system to get in the way and make a job more time consuming.

Drupal Summary

What type of site is Drupal good for? Well this is a tricky one, I find that it has a large number of features and modules to assist with building any website imaginable. I find that with those features built into core, performance issues can be a lot less rare. If you have little experience with it, there are still considerations to be made which can impact performance.

In my experience the Commerce module works very well. It can be a great choice if you want to get a site together quickly. Where I think it can be tricky is when you want a more customised experience. Like WooCommerce, Drupals Commerce module can make a lot of assumptions about how you want your site to function. If you are however happy and willing to make some compromises, it can be a good option.

If Drupal isn’t something you are familiar with take it slow, play with it a little and see some of the key benefits you can find with it. In comparison to WordPress, it is much more of a framework than a CMS. Once you get used to that, achieving the task at hand can be much faster due to its larger set of useful API’s or helper functions.

The key downsides to the framework is that because it is aimed at site builders, the CMS can feel cluttered and not friendly to users. In order to reduce that for normal site users, it can take time and care. I’ve noticed people say that the backend CMS is often a lot more daunting and confusing. So be prepared to be writing more documentation and assisting a client with content and site administration.

Craft CMS

Craft CMS backend screenshot
Happy Lager Craft Demo site backend.

Recently I’ve been diving into building sites within Craft. At first I wasn’t too sure about it. When working in an agency where speed is often key, I thought the lack of a theming system would slow the development process down. After speaking to some of the frontend team though, they see this as a huge advantage.

Craft CMS Advantages

is its simple user interface and mix of tools to allow you to build a site with specific requirements.

As I touched on in the above paragraph, one of the main advantages of Craft is that it allows a developer to have full control over the markup. This can be hugely advantageous and allow you to build a site with less restrictions.

I really like this in Craft and feel this is one of its greatest strengths. Of course with these strengths come weakness’ too.

Craft CMS Disadvantages

Unfortunately Craft has the least amount of plugins and a much smaller community backing it. This means that if there isn’t a plugin to achieve a specific requirement, you’ll unfortunately have to build it from scratch. It also means that when you encounter an issue, it’s much more difficult to find a solution for it.

Craft is also the only CMS in this list which you need to pay for in order to use. Whilst I feel like the cost is honestly worth it, I have to put it as a disadvantage when compared to other CMS’ on this list.

Finally due to the smaller community and lack of articles, it can take a lot longer to find the answer you need. A lot of the time this means I have to go through the source code of Craft with XDebug to look at how it works.

Craft CMS Summary

So what is Craft great for? I see Craft as an option which will take a lot more time to get the features you like but the lack of a theming system can be used to your advantage. Sites can be build with completely custom markup allowing the freedom and flexibility to build something with unique requirements. Simple brochure sites built in Craft can often take less time due to this but as feature sets of these sites increase, it can take much longer to build backend components with, when compared to other options on this list.

Craft has a much more modern approach to development than WordPress. Because of this, it’s great that you can easily reach for composer libraries speed up development time.

I get the feeling after using Craft for a while, it’s aim to to give you a CMS and framework to allow you to build bespoke websites the way you would like to. It tries not to make too many assumptions on how you should build your site. Depending on how you look at it this is either a good thing or bad. I’d say if you have a client with very bespoke requirements, Craft might be a great tool for the job, at the expense of it potentially taking a lot longer, especially for a backend developer.

Conclusion

To conclude, there isn’t really a single CMS or Framework that will fit every need or that is absolutely perfect. But I hope that this article might help you pick a better fit for your next site. If you have anything to add or disagree with any of my points, pop them in the comments below.

Great tools for Website and online Developers

In this post I discuss some of the tools I have used in the past and currently use today for organisation purposes.

At the moment, with the massive rise in open source projects there are so many great tools for developers. This post will outline the tools I use to help make my development life much easier.

GOGS

Gogs Logo (site tools)

For git repositories, GoGits (GoGs) is a great self hosted tool. GoGits is heavily influenced by Github in both its design and functionality. The way I use it is for hosting projects any projects which I may need to access elsewhere. At the moment I am primarily using it to test out new things and host a big range of projects that I can pick up when the mood strikes.

Built with Go, GoGits is an extra dependency to install on the server. Having multiple sites on one server I run it behind Apache which handles the SSL and means all my sites are configured in a similar way. I’m sure that GoGs offers all the functionality of having it be setup without the need for Apache. Maybe that’s something for me to add to my trello list.

Why not Github?

For a regular user like me I think that GoGs is probably a bit of an overkill as I don’t use half of the functionality it ships with. Having the ability to easily setup new repositories and just code though is great and incredibly useful. People probably are asking the question “Why don’t you just do it on GitHub?”. Three reasons:

  1. I use GoGs for testing and throwaway projects most of the time, so might not necessarily want them to be seen.
  2. I get the flexibility of everything been in one place where I can just share or make repos private without needing to worry about costs or another companies licences (Microsoft is coming!).
  3. The experience. It’s great to have something like this on a CV as it shows interest and are passion for the web and server configuration.

All in all I think GoGs is an awesome tool and if you feel like taking advantage of any of the benefits I mentioned above I’d recommend giving it a shot.

Trello

Trello Logo (Site Tools)

I mostly use Trello at the moment for a single massive board where I have a big list of things I want to learn and build. Trello makes it easy to just quickly note down any thoughts you may have wherever you are and everything always keeps in sync. It’s free and I’d definitely recommend it.

Personal Website

Wordpress Logo (Site Tools)

I first had the idea whilst looking for a new job to have a blog. Somewhere I could record my thoughts and share some of the things I have discovered with others. The site holds most of my CV and a few other blog posts which you may find interesting.

The site also allows me to document my ideas and give me something to look back to. The foundation for the site is currently WordPress just using the twenty seventeen theme. I did build it with the thought of building my own theme and learn a bit about plugins. Other things have however got in the way, as they often do so that part is on halt for the moment.

MediaWiki

MediaWiki (Site Tools)

I setup my own wiki which I would recommend to anyone. It runs on MediaWiki, a free to use PHP based Wiki site. I primarily use it to document anything I feel I may need to check/do repeatedly in the future. A great example of this is simple commands to refresh SSL certificates and various configuration examples from different frameworks. This helps greatly in keeping things documented and in a safe place where I know I can find them.

Conclusion

This concludes some of the main tools I am using on a daily basis, the majority of which are to help with project management and planning. I’m keen in future to share some of the tools which I use for development in a future post.

Talk soon!

Build a new site to help with my Dad’s Football sweepstake

Every so often an opportunity arises or an idea springs to mind for something new that you want to build. Even better when someone will use it.

Introduction

Every so often an opportunity arises or an idea springs to mind for something new that you want to build. Even less so when you can create a website that others might find useful. Enter https://shelleyfootball.club.

Shelley Football League Logo for the build

The Reason

In April I visited my parents house on a Sunday afternoon, I noticed my Dad was preoccupied with something. I wandered over and asked what he was doing. He showed me a large spreadsheet with people’s name, football teams and scores on it. Upon quizzing him further about it, he said that every season he runs a football sweepstake with some friends.

The Problem

Each week his friends drop £1 in a pot and pick a team from 4 leagues in the UK. Wins, Draws and Loses were researched and jotted down each week with points given out based on their pick. The process for this was all manual, with people emailing him with what team they would like that week. This was rather time consuming for him as each week my dad had to get scores for each of the teams.  Update picked teams for the coming week and make sure everyone else was aware of who picked what team.

Coming up with a solution

After itching to build something new and wanting to learn more Laravel, I pitched an idea. I asked if for the next season I could build a website which would automate the entire process. The football scores could be updated each week automatically and take into account the picks we got from players. I could automatically build the league table. The idea of him still being able to run this and keep his Sunday afternoons free for other things excited him. He therefore agreed to let me do it.

I noted down all of the requirements for things he needed and various rules. These were things like:

  • People can’t pick the same team twice in one season
  • People can’t pick opposing teams.

The Build

The Framework

As mentioned before I wanted to try and use Laravel for this so I could improve my skills with it. I love the framework as a whole and the functionality it packs in is amazing. It’s also free, which is perfect for this.

Emails

I built a mail server last year. It was always something I wanted to try out and felt it would allow me to learn more about security. Plus it’s pretty cool to have mailboxes with your domain that you don’t have to pay for!

Emails are an important part of the site as it’s the only way people can pick their team. I wanted to make sure it was right so ran through some online tests for the mail server to ensure that it was as secure as possible and not be blacklisted.

The Frontend

For the frontend functionality I opted for Vue.js. Mostly because I find it much easier to use than React and Angular. Also because Laravel ships with it.

For the CSS I opted to use Bulma. It’s a nice framework to use and has some nice helper classes, plus the documentation is spot on.

NOTE: You can find out about the server for this site and the Shelley Football Club one here: https://jaymeh.co.uk/updates-server-migration/

What I learnt and Conclusion

The process was a great exercise for me. Working in a development team with project managers and other developers you can often end up getting a specification created by someone else on the team. Usually it’s based on a meeting they had with a client. It was great for me to go through the process of building something personally for an actual client.

The site has had a few small bugs when we launched at the start of the season. These weren’t major though and overall everyone was able to get on and start picking. It was a great opportunity for me to improve my skills in Vue.js and to do some frontend too. All be it using the Bulma CSS framework but I think for a project like this, it was a perfect decision.

It’s also always nice to see people using something you poured a large amount of your time into.

See you next time.

Mailcatcher setup for PHP on Mac OSX

In this post I will be walking you through the process of setting up Mailcatcher on for PHP on MacOS.

In this post I’m going to talk about installing Mailcatcher for PHP on Mac OSX.  It is particularly useful when developing new websites as you can test emails without worrying if they are going out to a recipient.

This has two advantages:

  1. You can rapidly test emails without worrying that it will go out to it’s recipient
  2. You can save money on services such as postmark or mailchimp since development emails no longer will hit that service.

Installing Mailcatcher

Mac’s come preinstalled with Ruby so it’s as simple as installing a ruby gem. This is just a package manager which allows you to easily install programs and libraries. To install mailcatcher simply run the following.

Let it do it’s thing which will involve installed any dependencies for mailcatcher and finish setting up.

One completed successfully you can run the following:

If the program started successfully you will get the following:

If you open http://127.0.0.1:1080 you will be presented with the mailcatcher interface.

Screenshot of Mailcatcher interface

That’s the first part and mailcatcher is now setup for the mac. Next we need to link it with php, which is covered in the next section.

Setting Mailcatcher up with PHP

Once this has been setup we now need to link it to PHP.

First we need to find out where catchmail (a program installed with mailcatcher) has installed to. I’m going to assume it’ll be located in the following directory:

However if you are unsure you can run the following command:

This will return the directory path for catchmail. We will need this later.

Next we need to find the php.ini file so that we can configure catchmail to respond to the mail() command in php. You can find this by running

And finding the configuration file path function. e.g.

Once found open up the file using your favourite command line text editor:

Update the following:

to

And update:

to

Once the above has been done save the file and quit out.

Restart php locally and try to send a test email using the mail() command.

If you open up the following url: http://127.0.0.1:1080

You should now see your email going into Mailcatcher.

Congratulations you now have a working setup for testing development emails. Good job!