Creating the API's public routes and their modules is very similar to the API you learned to build in the previous chapters of this book; the main difference is the language. We used JavaScript and the Node.js framework – Koa, previously, while for the API in this chapter, we are using PHP and PSRs to create a framework-agnostic API. So, let's get started:
- Create two directories in the /module/ directory: one called Home and another called User. These two sub-directories are the modules in this API. In each module, create a /_routes/ directory and an index.php file that will import the routes from the /_routes/ directory, as follows:
└── module
├── Home
│ ├── index.php
│ └── _routes
│ └── hello_world.php
└── User
├── index.php...