Slim example project

Coverage Quality Gate Status Maintainability Rating Lines of Code

This project showcases an example of a backend and frontend built using the Slim micro-framework.

The primary goal of this project is to provide a modern codebase with a scalable project structure and a range of practical features. These can serve as learning examples or be adapted for developing new applications.

External library dependencies are kept to a minimum to facilitate maintenance and ensure long-term viability.

Installation guide

GitHub source

Features

All features were developed with an effort to ensure maximum user-friendliness. It is important to me that the frontend is intuitive, aesthetically pleasing, minimalistic, and functional.

The project is currently designed for non-profit organizations or foundations that require a platform to manage the people they assist and maintain a record of communication through notes.

Project components:

  • Authentication (login) and authorization (permissions)
  • Account verification and password reset via email link and token
  • Protection against rapid fire and distributed brute force attacks (time throttling and captcha) – docs
  • Localization – English, German, and French
  • Flash messages
  • Request body and input validation
  • Template rendering with native PHP syntax
  • An intuitive method for editing values in the browser using “contenteditable”
  • Dark theme
  • Custom error handler – docs
  • Integration testing with fixtures and data providers docs
  • Database migrations and seeding docs


Application components demonstrating re
al-world features as examples:

  • Users with 4 different roles and different permissions
  • User management for administrators
  • User activity history
  • Client creation and mutation with status and attributed user
  • Client list filtering by text input and filter chips
  • Note creation and mutation for clients with different permissions
  • Notes hidden from unauthorised users
  • Dashboard with panels

 

View demo

Link: demo.slim-example-project.samuel-gfeller.ch
Usernames: admin@user.commanaging-advisor@user.comadvisor@user.comnewcomer@user.com
Password: 12345678
The database is reset every hour.

Technologies

Frontend

Languages & libraries

Besides HTML and CSS mainly vanilla JS is used to be as “native” as possible utilizing ES6 JavaScript features extensively.

Template renderer: slimphp/PHP-View

Backend

The required libraries are carefully chosen to minimize dependencies on external libraries as much as possible.

 

Dev

Background

There is a ton of great content on the internet about learning how to write clean and sustainable code, but I found myself wishing and searching for more than just skeleton projects or general documentations when I wanted to learn how to do more complex things within the scope of a potential real-world application. I never found resources such as an open-source, efficient implementation of all the features surrounding a full-sized project.

One example of the many things I searched online when I wanted to learn how to build a solid, scalable project, are complex integration test cases, like authorization of actions with different roles in different contexts.
This project provides not only that but also documentation along with it in the testing cheatsheet. It also adresses what should be tested.

Credits

This project is inspired by Odan’s awesome knowledge baseebook and the slim4-skeleton project.
Daniel made developing this project so much more fun. Big thanks to him for helping me out and guiding me when I was stuck or when I didn’t know what a specific best practice was. Follow him on Twitter.

Special thanks to JetBrains as well for supporting this project. PHPStorm is by far the best PHP IDE; I cannot recommend it enough.

Licence

The MIT Licence (MIT). Please see the Licence File for more information.