Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
php-mvc
A simple PHP model-view-controller framework, built step-by-step as part of the "Write PHP like a pro: build an MVC framework from scratch" course on Udemy.
-
learning-oop-in-php
A collection of resources to learn object-oriented programming and related concepts for PHP developers.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Others have covered MVC, but a somewhat similar alternative is ADR, which more API-centric in nature as opposed to a dynamic website where you are primarily returning HTML.
Or you can also build your own by picking and choosing libraries. Follow the No Framework tutorial for one. Symfony has many components to choose. Laravel too, with some work. Add PHP-DI (Dependency Injection Container), FastRoute (router) or something similar, and you have your own version of Slim.
If you still want to go the custom route, though, Dave Hollingworth has some example code from his PHP MVC Udemy course that I found extremely helpful and was some of the first material that I used to start learning new stuff. Basically, you set up the server, or htaccess, to restructure the URL query string, then use regular expressions to parse it and get the values.
- Clean Code PHP - Examples of good and bad habits/standards to use in your code
- Klein
- Learning OOP in PHP - huge list of resources for learning
- FastRoute
- Symfony's Router
You can also use this for a simpler API to help you get started- https://github.com/noodlehaus/dispatch
Try Slim again. The setup may be too much, but the concept is the same. Look at the first application or any of the skeleton apps to help (https://github.com/odan/slim4-skeleton for one).