Introduction
Table of contents
Loading...Background
When I was really getting into coding, I was seeking a way to learn how to create performant, long-lasting, flexible web applications with low complexity and maintenance costs.
After having worked with Symfony at the company I was employed by, I knew that big frameworks were not the way I wanted to go.
I've always been repellent to learning things the "framework way". I want to learn how to do things properly in the native language with minimal packages strictly where they're necessary and not follow propitiatory rules of a framework that doesn't always follow standards and best practices. I wouldn't feel comfortable having all my application code be dependent on a framework that makes major changes every few years.
So it was clear, I wanted to learn how to design a web application with minimal dependencies. I started by creating a vanilla PHP router with a simple MVC structure and trivial dependency management.
Soon I realized the limits of the way I was doing things.
It was hard to follow best practices, and I wasn't happy with the way I included dependencies
and how the controller rendered templates.
I started looking for a micro-framework that would take over the routing (bootstrapping, middleware, handle request, return response, etc.) without dictating how I should develop features and structure the code.
The Slim Framework was the obvious choice for being so popular, lightweight, with an active community, supporting PSR standards, and being so performant and flexible.
With the intention of creating a base for my future projects, and to learn how to create a full-sized real-world application, I started development on the slim-example-project.
Five years and some long days of coding later, I was finally happy with what I've learnt in terms of creating a durable web application with Slim and PHP.
Daniel Opitz (Odan) was a great source of inspiration for me. He is an experienced developer and architect who knows PHP frameworks, design patterns and best practices very well, and his publications were precious input for me. I've learnt a lot from him; he was almost always there to answer my many questions throughout the years.
I felt that this newly gained knowledge was too precious not to share, so I did my best to document everything I learned in an accessible language and with lots of examples.
Sincerely, I hope this documentation and example project will be able to help out at least some people who are in the same situation as I was or developers that want to expand their knowledge.
Disclaimer
This project and its documentation are the result of my personal learning process in the last years focusing on creating the best possible template app with lots of real world examples.
The codebase is big and thus lots of subjective decisions had to be made that may not be the best long-term solution for everybody.
The main focus throughout the development was to make the code as long living as possible with best practices and few dependencies so that it can be adapted to different needs and preferences.
I worked closely with the software engineer and architect Daniel Opitz, who I mandated to review the example project, but I absolutely cannot guarantee that this is the best way for you to do things.
Support
Please read the Support❤️ page if you value this project and its documentation and want to support it.