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

Using Composer Dependency Manager

Using Composer Dependency Manager

In days gone by when you wrote a project in PHP you would often write all parts of the project yourself, or you probably had code components from previous projects that you copy and pasted into your new project. You may even have gotten a third party library from the web. Of course in these days gone by you also had to figure out how to load the code into your new project. Composer Dependency Manager came along and changed…

Read More Read More

Facebook Share Button Missing Image

Facebook Share Button Missing Image

  On one of my client’s sites they have the regular social sharing icons. When a visitor clicks on the share to facebook link it populates that share with some default info, and very importantly the image. This is important to them because they run image voting sites. I was asked to see if I could fathom why the image was missing on facebook sharing. The first thing I checked was the open graph (OG) tags on the site. The…

Read More Read More

PHP Traits

PHP Traits

What are PHP traits? In genetics, traits refer to a characteristic or an attribute in your DNA. For instance, you have a trait for eye colour, or hair type. In PHP traits refer to a set of common functions which can be used by multiple classes. I think of it almost as “includes for classes” (don’t quote me on that, its just a conceptual way of looking at it). As with most programming languages, PHP is easiest learned by example,…

Read More Read More

Dependency Injection

Dependency Injection

Dependency injection is a design pattern which allows you to inject your dependencies into a class, rather than have them loaded from within that class. This blog post on PHP dependency injection will be an example based post without too much commentary from me.   Typically when we write our classes they require functionality from other classes. One way of achieving this is to include and load a new instance of the dependency within our class. Another possibility is that…

Read More Read More