Linked Lists

Linked Lists

Linked lists are a data structure in which the data nodes are linked together via pointers. Pointers point to something. In this case a node points to another node. Linked lists are useful in building up other data structures like binary search trees etc. In this blog we’re not going to use pointers to memory as we would in a language like c, we’re rather going to emulate this with simple arrays. We’re going to discuss then extremely briefly and…

Read More Read More

Laravel Factories

Laravel Factories

When creating an application you’ll often want to add in dummy data for testing functionality, layouts etc. PHP has an excellent faker library to create all manner of fake/dummy data like email addresses, names, surnames etc. This faker library comes packaged with Laravel, ready to use. A quick Laravel faker test. We’ll do a quick faker test. Open up tinker and get a name. name will return a full name in the format “firstName lastName”. In tinker, type: fake()->name();. You…

Read More Read More

Streamlining API Versioning in Laravel: A Smart Approach to Route Inheritance and Overrides

Streamlining API Versioning in Laravel: A Smart Approach to Route Inheritance and Overrides

A new Laravel install has several route files. The two most widely used route files are routes/web.php and route/api.php. As their names imply, these are for web (browser) routes and API related routes. In this post we’re only going to be looking at the API route. Let’s assume that we have a GET endpoint to get a list of all users in our API. We could do this simply in the route file (typically we’d set up controllers etc but…

Read More Read More

Web sockets | real time communication between front and back ends

Web sockets | real time communication between front and back ends

NOTE: I have a new post in the pipeline about web sockets using Laravel’s Reverb which is new in Laravel 11 as well as Laravel’s echo on the front end. I will include a link to that post here once its up. This is a more general post so perfectly usable in PHP without a framework. Its been a while since I’ve written a post and this is a good one (if I do say so myself!). In today’s fast-paced…

Read More Read More

Laravel Service Container

Laravel Service Container

In the realm of web development, managing dependencies effectively and ensuring code remains flexible and maintainable is crucial. Laravel offers a powerful tool known as the Service Container to address this.

In this post, we’ll delve into understanding the Laravel Service Container, why it’s invaluable, and how it can make your development process smoother. We’ll explore the intricacies of Dependency Injection, the significance of Interfaces, and the convenience of Laravel’s app() helper function.

Install and configure HA Proxy on Ubuntu

Install and configure HA Proxy on Ubuntu

Installing the latest HA Proxy You could use sudo apt-get install haproxy, but the version in the repo is likely not the latest stable release. To get the latest stable release, check on the HA Proxy site which is the latest. At the time of this writing it was 2.5. You can use PPA (personal package archive) on Ubuntu to get the latest version: sudo apt install –no-install-recommends software-properties-common sudo add-apt-repository ppa:vbernat/haproxy-2.5 -y sudo apt install haproxy=2.5.\* Adding¬†=2.5.\*¬†to the end…

Read More Read More

How to check your paypal account age

How to check your paypal account age

Paypal have done a decent job of hiding your own info from you. You may want to know when you opened your paypal account (as I recently did as part of a vetting process). The info seemed to be well and truly “not there”. Fortunately I stumbled across a link, which I am keeping here for future reference: https://www.paypal.com/businessprofile/settings/info

Location API

Location API

Its been a really really busy few months and the blog posts have been slow. This one is more of a documentation to myself, but the new location API may be useful to you, and you may have additional sources of data! The idea is simple. How many times have you needed an API you can call to get the states (provinces) in a country? How many times have you needed to drill down to counties? Cities? Postal codes? This…

Read More Read More

How to set up an nginx web server in 3 easy steps

How to set up an nginx web server in 3 easy steps

How to set up an Nginx Web Server in 3 easy steps Get a Server with Ubuntu Get a domain name Get WebCP.io web hosting control panel   In case you’re wondering how to set up an Nginx web server with PHP 7.2, mail, webmail, FTP, built-in optimisation and built-in security, you’re in luck. I’m going to show you exactly how it’s done. And it’s easier than you think. 1. Get a server: What I use for SoftSmart is an…

Read More Read More

Auto Loading in PHP

Auto Loading in PHP

Auto loading in PHP is the means by which to load classes (and traits and things!) without needing to specifically require the class file. On smaller projects with one or two classes and a handful of files this might not seem like a big deal, but on larger project, particularly with classes from different vendors, and in frameworks like Laravel, auto loading becomes particularly important. Our file structure To follow this PHP autoloading tutorial you should be aware of our…

Read More Read More