-
-
Notifications
You must be signed in to change notification settings - Fork 4
Home
This repository showcases the implementation of a simple yet robust architecture with a wide variety of backend and frontend features 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.
All features were developed with an effort to ensure maximum user-friendliness. Frontend has to be intuitive, aesthetically pleasing, minimalistic, and functional.
The project is currently designed for non-profit organizations or foundations that require a platform to manage and maintain a record of communication through notes of people they assist.
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 real-world features:
- 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
Link: demo.slim-example-project.samuel-gfeller.ch
Usernames: admin@user.com
, managing-advisor@user.com
, advisor@user.com
, newcomer@user.com
Password: 12345678
The database is reset every hour.
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.
This is what I tried to do here. I wanted to create a project that is not only a skeleton but also contains a lot of practical examples of how to implement features that are often needed in real-world applications.
One example of the things I desperately searched when I wanted to learn how to build a scalable project
were complex integration test cases such as authorization of actions with different roles in different
contexts.
This project provides that and also documentation along with it in the
testing documentation and
testing cheatsheet.
It also adresses what should be tested.
Another example is the implementation of a robust security concept. How to protect against brute force
attacks? Or XSS attacks or against email spamming?
Probably not perfect but there is a relatively simple
implementation of these
concepts in this project.
Authorization, localization, validation, error handling, database migrations and lightweight php template rendering are other examples of features I did not find many open-source lightweight real world implementations.
Of course there are big frameworks that have answers to all these problems, but I find them often too complex, where the code makes too much "behind the scenes" combined with a high dependency and time-consuming refactoring on version changes.
I prefer to carefully choose single libraries where they make most sense and maintain the rest of the codebase myself to stay in control, keep it lightweight, performant and tailored to my needs.
Slim app basics
- Composer
- Web Server config and Bootstrapping
- Dependency Injection
- Configuration
- Routing
- Middleware
- Architecture
- Single Responsibility Principle
- Action
- Domain
- Repository and Query Builder
Features
- Logging
- Validation
- Session and Flash
- Authentication
- Authorization
- Translations
- Mailing
- Console commands
- Database migrations
- Error handling
- Security
- API endpoint
- GitHub Actions
- Scrutinizer
- Coding standards fixer
- PHPStan static code analysis
Testing
Frontend
Other