Quantcast
Channel: Matthew Daly
Browsing all 158 articles
Browse latest View live

Creating custom assertions with PHPUnit

Today I’ve been working on a library I’m building for making it easier to build RESTful API’s with Laravel. It uses an abstract RESTful controller, which inherits from the default Laravel controller,...

View Article


Building a postcode lookup client with HTTPlug and PHPSpec

While PHPUnit is my normal go-to PHP testing framework, for some applications I find PHPSpec superior, in particular REST API clients. I’ve found that it makes for a better flow when doing test-driven...

View Article


Full text search with Laravel and PostgreSQL

I’ve touched on using PostgreSQL to implement fuzzy search with Laravel before, but another type of search that PostgreSQL can handle fairly easily is full-text search. Here I’ll show you how to use it...

View Article

Using UUIDs as primary keys with Laravel and PostgreSQL

For many applications, using UUID’s as the primary keys on a database table can make a lot of sense. For mobile or offline apps, in particular, they mean you can create new objects locally and assign...

View Article

Creating Artisan tasks that generate files

While the documentation for creating Artisan tasks is generally pretty good, it doesn’t really touch on creating tasks that generate new files. The only way to figure it out was to go digging through...

View Article


Using Artisan from standalone Laravel packages

Recently I’ve been building and publishing a significant number of Laravel packages, and I thought I’d share details of some of them over the next few days. Artisan Standalone is a package that, when...

View Article

A Laravel package boilerplate

The second package I’ve been working on recently is Laravel Package Boilerplate. It’s a basic starter boilerplate for building your own Laravel packages. It’s not meant to be installed as a project...

View Article

Adding dynamic flat pages to your Laravel app

Most web apps have at least some need for some additional flat pages, for purposes such as: Terms and conditions Cookie/privacy policy FAQ You can of course hard-code this content in a view file, but...

View Article


More tricks for speeding up your Laravel test suite

When you first start doing test-driven development with Laravel, it can be quite hard to produce a test suite that runs quickly enough. The first time I used Laravel for a large project, I had a test...

View Article


Adding comments to models in Laravel

Laravel Comments is a package I recently released that allows you to add comments to any model in your application. Possible models you could use it to enable comments on might include: Blog posts...

View Article

Creating an Artisan task to set up a user account

When working with any Laravel application that implements authentication, you’ll need to set up a user account to be able to work with it. One way of doing that is to add a user in a seeder, but that’s...

View Article

Getting the type of an unsupported Postgres field in Laravel

Today I’ve been working on a generic, reusable Laravel admin interface, loosely inspired by the Django admin, that dynamically picks up the field types and generates an appropriate input field...

View Article

Creating Laravel Helpers

Although helpers are an important part of Laravel, the documentation doesn’t really touch on creating them. Fortunately, doing so it fairly easy. Here I’m building a helper for formatting dates for the...

View Article


Easy repositories and decorators with Laravel Repositories

Creating repositories for your Laravel models, as well as creating caching decorators for them, is a useful way of not only implementing caching in your web app, but decoupling the application from a...

View Article

Adding OpenSearch support to your site

For the uninitiated, OpenSearch is the technology that lets you enter a site’s URL, and then press Tab to start searching on that site - you can see it in action on this site. It’s really useful, and...

View Article


Creating a caching user provider for Laravel

If you have a Laravel application that requires users to log in and you use Clockwork or Laravel DebugBar to examine the queries that take place, you’ll probably notice a query that fetches the user...

View Article

Deploying your Laravel application with Deployer

Deployment processes have a nasty tendency to be a mish-mash of cobbled-together scripts or utilities in many web shops, with little or no consistency in practice between them. As a result, it’s all...

View Article


Why the speed of your MVC framework is usually a red herring

Skim through any programming-related forum and you’ll often find statements along the lines of the following: “I chose Lumen for my website because the benchmarks show it’s faster than Laravel” “I’m...

View Article

How I deploy Laravel apps

A while back I provided details of the web server setup I used for Django applications. Nowadays I tend to use Laravel most of the time, so I thought I’d share an example of the sort of setup I use to...

View Article

Using Lando as an alternative to Vagrant

Although Vagrant is very useful for ensuring consistency between development environments, it’s quite demanding on system resources. Running a virtual machine introduces quite a bit of overhead, and it...

View Article
Browsing all 158 articles
Browse latest View live