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 worked for, 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 do 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 flexible.
With the intension 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, quite a few headaches and long days of coding later, I was finally done with learning most of the aspects 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 gave me an additional validation that this "simplified" path was the right fit 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 simple phrases and examples that anyone could understand.
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 there is absolutely no 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.
Read more
- Samuel Gfeller: Libraries and Framework
- Daniel Opitz: Framework vs. Micro Framework
- Daniel Opitz: PHP Microframework Slim auch für größere Anwendungen geeignet