Photo by Mario Rodriguez | https://unsplash.com/photos/eWVKHGWnTnM

Skeletor: the Laravel skeleton generator

Wouter P.
Pixel Fusion
Published in
4 min readOct 4, 2017

--

It has long been a pet peeve of mine, that every time you start a new Laravel project you end up installing the same plugins and doing the basic configuration of each of them to make it work.

Laravel 5.5 introduced package auto discovery which reduces the amount of time required to install Laravel-specific packages by automating the configuration of service providers or facade aliases.

This is a great step forward but you depend on the package maintainers to implement this feature. As it’s quite new, it will take a while for everyone to follow suit. It also doesn’t solve the problem of other types of configuration that might be required, like adding environment variables to your .env file.

At Pixel Fusion, we have a team of 10 backend developers that create new Laravel projects on a regular basis. About a year ago, I decided to come up with a solution to make it easier to create a new Laravel project and hit the ground running in the blink of an eye. After a couple of small prototypes, I had a general idea of what features I wanted and the idea for Skeletor was born.

In the beginning of the year, we were lucky to have Thijs Bouwes as an intern at Pixel Fusion. Being the awesome guy he is, he was able to take my simple brief and bring Skeletor to life (see what I did there?).

After a few iterations, we had a basic CLI tool that allowed us to create a new Laravel/Lumen project based on a few simple questions.

First version of the Skeletor CLI

This created a base Laravel/Lumen app, applied some of our preferred tweaks and installed the chosen packages. It was already great, but of course we didn’t stop there. I realised that by building Skeletor, we were able to solve another problem our team was having. If you are a PHP developer you will recognise this scenario:

Me: I need to add roles and permissions to this project. What was that package that I used last time? I think it was the Spatie one but I’ll ask the other developers too to see if they have other suggestions.

Other developers: The Spatie one is good but you can also use Bouncer, Defender, Sentinel or…

Me: Ok, that’s enough, thanks!

Skeletor allowed us to come up with a list of preferred packages to create more consistency between our projects by using the same dependencies instead of reinventing the wheel every time.

When adding different packages, we found that we needed more ways of automatically configuring them. Along the way, we’ve implemented a bunch of features that reduce configuration stress by 95% (rough estimate, not scientifically proven).

Below are some of the most important features:

  • Automatic registration of Laravel service providers and facade aliases (before 5.5 even existed)
  • Publishing package configuration
  • Automatic updating of .env and .env.example files
  • Updating the composer file before a package is installed to allow you to setup custom composer scripts for example
  • Ability to configure specific packages to be installed automatically
  • Replace the standard readme with a custom one

The latest release of Skeletor now supports Laravel and Lumen 5.5 and comes with a whole lot more suggested packages.

Install all the packages!

Skeletor can be installed as a global composer package (i.e.,composer global require pixelfusion/skeletor). To prevent anyone from creating a new project with an old version of the Skeletor CLI tool, we’ve recently implemented a version check using the Github API.

Version check to prevent using an out of date version of the Skeletor CLI

What are you waiting for? Go check it out on our Github page and read the docs if you are interested in adapting it to your own needs.

There are a few bits and pieces that are specific to our use case but it should be easy to fork the project and tailor it to your own needs. Let us know if you do because we are interested to know the percentage of configuration stress reduction you have achieved for your team.

Peace out!

--

--

Wouter P.
Pixel Fusion

Geeky developer dude. Pro surfer of the virtual kind.