Rebuilding my invoicing application in Laravel, Part 1 - Introduction

A few years ago, I built a custom application to make it easier to invoice clients. Recently, I've been thinking about making some updates to the application. Let's get started!

A few years ago, I built a custom application to make it easier to invoice clients. Recently, I've been thinking about making some updates to the application. Specifically, updating it to Laravel 5.5 and using Vue components to handle much of the UI/UX. So, I decided to just convert the project on a new install of Laravel and make a few blog posts to go along with the the start of this rebuild. In this post, I'll just give a quick overview of the main features and perform the basic initial setup.

Features

There are 3 primary functions of my invoiving application which are creating clients, invoices and work orders. I built this system help me with better invoicing and time tracking practices. It does this by forcing me to always have an invoice to refernce work/time to. So before I can create a work order, I must have an invoice to reference. This means at the end of the month, it is dramatically easier for me to send invoices.

Clients

This section is fairly simple. I can add clients and client contacts. It also shows me list of information relating to the client such as invoices and work orders.

Invoices

After creating an invoice, I can add basic items, work orders and payments. Details about a work order show up automatically on the invoice.

Work Orders

Work orders are the heart of this application. These keep track of the time spent and tasks accomplished. They provide details to the client about the work that has been done.

Credit Card Payments

Using Stripe, this application makes it easy for clients to make payments with credit cards. The application provices a public link for the client to view the invoice and make the payment.

Getting started

Before I get started, I'll get the bare minimun setup in order to start working on this rebuild.

Shiny new Laravel install and GIT

Creating a fresh install of Laravel is super easy with the laravel installer. Let’s create a folder called invoicing and install Laravel inside.

laravel new invoicing

I’ve creating a new repository on Github and called it “invoicing”. Now I need to setup the git repository locally and then push it to the new hosted repository.

First, I’ll move into my new application folder called “invoicing”.

cd invoicing

Then initialize the repository locally, make my initial commit and create and checkout a development branch.

git init
git add .
git commit -m "initial commit"
git checkout -b develop

Next add remote and push to Github.

git remote add origin git@github.com:philmareu/invoicing.git
git push -u origin —all

I’m using Valet so I can just visit invoicing.dev on my local machine and see the Laravel welcome screen.

Database

I'll create a database for this rebuild and set it up. Again, I’m using Valet so setup is a breeze.

.env

DB_DATABASE=dev_invoicing
DB_USERNAME=root
DB_PASSWORD=

Namespace

Let's update the namespace to align with the project name.

php artisan app:name Invoicing

Testing setup

Laravel supports PHPUnit and makes it quite enjoyable to write tests. I'll start the setup by defining some database information.

phpunit.xml

<env name="DB_DATABASE" value=":memory:"/>
<env name="DB_CONNECTION" value="sqlite"/>

For browser tests, I will use Laravel Dusk. Let's get it installed.

composer require --dev laravel/dusk
Using version ^2.0 for laravel/dusk
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing facebook/webdriver (1.4.1): Downloading (100%)         
  - Installing laravel/dusk (v2.0.7): Downloading (100%)         
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: laravel/dusk
Package manifest generated successfully.

Then install and update the url.

php artisan dusk:install

.env

APP_URL=http://invoicing.dev

That's it for now. The next post starts the actually development work.

2019 Phil Mareu - Coder, Traveler & Disc Thrower