At Spatie we use a homegrown Laravel template called Blender. It’s being used on nearly all our projects. When starting with a greenfield project we take a copy of Blender and make project specific changes in that copy. We built it because we want maximum flexibility and don’t want to be hampered by the limitations of a one size fits all out of the box solution. The whole team is constantly tinkering and improving Blender, it’s an experimenting ground for learning new techniques.
A few weeks ago I put the source code of Blender in a public repo on GitHub. There are several benefits in doing so:
- Because the quality of the code is directly reflecting on our company, there is a extra incentive to deliver quality.
- Potential clients can inspect our code before trusting their projects to us. They will hopefully agree that anybody proficient in Laravel can modify Blender.
- All tools like Travis, Scrutinizer and Sensiolabs Insights and GitHub can be used for free.
- In time, we might get quality pull requests like the ones we’re get on our public packages.
This is how the login screen and back-section look like:
If you need a good Laravel based CMS that is well documented and intended for public use take a look at Asgard CMS, October CMS or one of the many alternatives. But if you want learn a bit by diving into code head over to the Blender-repo on GitHub. You might discover some things that could come in handy in your projects.
Some interesting tidbits on how Blender works:
- Most projects have three main sections: the back-section (to administer content), the auth-section (logins / password resets) and a public facing section. Each section has its own route file that is being loaded by the route service provider
- Blender has several goodies built in to support multilingual sites. The languages that are needed in a project are specified in the config file. The route service provider will prefix routes of the front-section with a the current locale. There is a dedicated class to determine the current locale of the app.
- We use a bunch a packages and are eating our own dog food.
- All content (such as news or articles) can be administered in the back section. Each content type has it’s own model, controller and views. Because there is a lot of logic shared these models and controllers are inherited from a base model– and base controller-class. The actual models and controllers remain quite skinny.
- Forms to administer content in the backsite can be created very fast using the form builder so views can remain minimal.
- To improve performance we can decorate repositories.
- “Push forward” is our motto and we try to use the latest Laravel features whenever possible.
- The client side to our media library has recently received a nice upgrade and is now entirely built with React.
Putting the code on GitHub is just a first step. We currently offer no support and no public documentation. Though it might take a while that might change in the future. If we ever get to that point, we can leverage the power of the community to improve our code.
You may use Blender for your own projects but please note that we offer no support whatsoever and do not guarantee that the code is stable. In short: when using Blender you’re on your own. But don’t let that stop you reading the code on GitHub.