Category Archives: Laravel

Laravel 4.2 Set up Cron for Laravel Artisan Command

Brief instructions to setup a Cron job on Ubuntu for a Laravel PHP Artisan Command.

Create a Crontab for the vagrant user
$ sudo crontab -u vagrant -e

Add the following lines:

#test the cron every minute
*/1 * * * * /usr/bin/php /vagrant/ahvla-beta/artisan command:login-access –status=enable –disable-confirm=1 –disable-log=1

#test that the cron is running without PHP dependancy
*/1 * * * * echo “$(date)” >> /vagrant/project-root/cron-contents.txt

Save the file.

Check the contents

$  crontab -l



How to install CloudFlare’s Free SSL on Laravel

… when you’re too stingy to use a full paid for SSL ;) or during development of course …

Following instructions doesn’t quite work due to the infinite number of various setups available.

Digital Ocean, Forge, Nginx, Cloudflare free SSL, Laravel 5.1, Laravel Collective Forms


  • SSL is already running in Cloudflare for website. However, Laravel doesn’t know about the SSL, so is generating none secure absolute URLs for the form methods.  An unlogged error along the lines of method not allowed:

MethodNotAllowedHttpException in RouteCollection.php line …


  • Create a Self Cert certificate on your server in /etc/nginx/ssl
  • Edit the site’s nginx file /etc/nginx/ssl to point to the cert
  • If using Lavavel Forge: Install Existing Cert; Add the key and cert. Get the contents for each file from /etc/nginx/ssl/
  • Cloudflare: Set the SSL to Flexible


Why Would You Do This!?

The Penny’s Dropped

A few years ago, I kept seeing weird code in reputable projects. It didn’t make sense.

if (7 == $day) {
// do nothing

Any normal person would have written this:

if ($day == 7) {
// do nothing

They mean the same thing but the latter is more readable.

But it’s also frightening similar to:

if ($day = 7) {
// do nothing

But day was 3 and we’ve just set it to 7 and no one’s turned up for work.  (Yes text editors might flag up this inadvertent bug with pretty colours), but they might not.

It’s a very difficult bug to detect as it’s consequences can go unnoticed for ages.

However, doing this reveals the bug instantly:

if (7 = $day) {
// do nothing

This is called Defensive Programming. A good habit to get into, but expect the time saved in bug detection to be allocated to discussing why you’re writing weird code to inquisitive inexperienced colleagues.

Short Part of IF at the Top

Another scenario is having the shorter, less important part of an if(){} statement at the top:

if (false ) {
// quit
} else {
// do this
// do that
// do this
// do that
// do this
// do that
// do this
// do that

This ensures the shorter condition doesn’t get forgotten about. A text editor with code collapsing helps, but when using VIM or Nano it’s not always an option.

Hello from Bournemouth.

Laravel PHP Freelancers Bournemouth

Laravel PHP Freelancer Bournemouth

Whether you’re another web agency, co Laravel freelancer or end client needing Laravel skills, we would be interested in helping you with your Laravel project.

We diligently start off the day watching Laracasts before pressing on with Laravel PHP development.

We use Forge with Digital Ocean for the production server, and Homestead for the local development server(s).

14 Years PHP Developer Experience

That’s a long time we’ve been writing PHP! PHP frameworks didn’t exist then. Back in the day, we had to write everything from scratch – from CMS, shopping baskets and forums.

We learned at University that there’s no such thing as a job for life – well PHP isn’t going anywhere for another 14 years so it really is a job for life.

One consideration, PHP is ever changing, as well as all the tools, frameworks and frontend stuff that go with it.

Endless learning.

How to Chose a PHP Developer

Ensure they know Object Oriented (OO) PHP, have at least 5 years commercial experience, and are fluent in Laravel, Zend Framework 2, Phalcon or other modern MVC PHP frameworks.

They need to have worked on at least 5 big PHP projects before getting a real understanding of how to organise and manage code.  Even better, ensure the PHP freelance developer has started projects from scratch.  It’s easy to dive into an existing PHP project, with colleagues to help with questions, but a PHP programmer who has single handedly created massive projects alone, and from scratch, has invaluable experience.  Obviously they’d need to have collaborated too!

Get the balance and the skills right. For Web App Development, choose Ringwood Internet, near Bournemouth.

Zend’s Dead Baby, Zend’s Dead

In our world anyway.

We tried Zend Framework 2. Timing was wrong. It was too new, not enough support or forums.  ZF1 was too old and not worth becoming more familiar with unless we’re thrown into a legacy project.

Zend courses are really expensive.  Recently we looked at the number of world wide Zend Accredited Engineers, and noticed peak was in 2009, although now the data is displayed differently it’s harder to confirm that finding.

Zend Server didn’t work on the Mac. It needed a reinstall every few weeks after strange frustrating problems. The Phalcon Module wasn’t compatible with it (not even sure it’s compatible with the Windows version – didn’t work in the VM anyway).

Last year CodeIgniter was a disappointment. Stack Overflow was saturated with a questions proving a lack of basic PHP understanding so it was difficult to get proper CodeIgniter help. CodeIgniter didn’t provide many useful features other than the MVC layout.

Laravel to the Rescue :)

There is so much support, documentation and help for Laravel. Everyday new Laracasts are being added.  £150.00 for lifetime membership – and you can watch the videos more than once.

We look at these like a video manual more than a training exercise.

The courses are for any level and go deep into OO PHP and  Software Design Patterns.

We feel like we’re moving forward quicker than ever.

Laravel PHP Developers Bournemouth

We have succeeded in refactoring our legacy Letting Agent Software PHP code into the Laravel PHP framework – to Alpha testing stage.

We took a step back and looked at the legacy code. Although we’d inadvertently stumbled across the MVC software design pattern during this project, migration Laravel was a no brainer.  We gambled that it would be quicker to refactor the entire project than to add a bulk of new features to the legacy PHP code.

The speed in which we’ve refactored our Letting Agent Software was a pleasant surprise to us.  We are now in a suitable position to create single page apps by adding Angular to the front end.

It’s now full steam ahead with the new software features.

We are always keen to hear from other Laravel developers in Bournemouth so do drop us a line – contact Ringwood Internet!


Bash Aliases for Laravel

Typing $ php artisan is getting tiresome. So how to create an alias in Bash on the Mac:

Edit ~/user/.bash_profile

//Add the line:
alias pa=”php artisan”
// pa is my chosen alias

// Add an alias to the project directory while we’re here:
// progexample is the alias name for the example project
alias projexample=’cd /Applications/XAMPP/xamppfiles/htdocs/’

Save and reload the profile from it’s directory location in the terminal:
$ . .bash_profile

Now, $pa migrate is the same as $ php artistan migrate

And to jump straight to the specific project directory it’s: $ projexample

Create Aliases for Aritsan

$ alias g:m=”php artisan generate:migration”

$ g:m create_orders_table –fields=”title:string, description:text:nullable”

Here are some Laravel Bash Aliases