A REST Web Service, commonly referred to as Web API, allows client applications to access (retrieve) and manage (create, delete, and update) data the service is providing. It uses a database to store the data it manages and exposes this data as Web resources so that client applications can interact with it through HTTP’s uniform interface.
This repository contains an application skeleton for creating REST-based Web services. The latest version of the Slim micro framework is being used.
Follow the instructions below in the specified order:
- Download v1 or v2 folder as
.zip. - Extract the downloaded
slim-template-main.zipfile locally. - Copy the
slim-template-mainfolder into your Web server's document root (that is,htdocs) - Rename the
slim-template-mainfolder to[project_name]-api. For example,worldcup-api - Open your
[project_name]-apifolder in VS Code - Open a terminal window in VS Code (hit
Ctrl+`), and run the following command to install or update the required dependencies in a VS Code terminal window (hitCtrl+`)
composer.bat updateNOTE: You can always clone this repository. However, if you do, you need to remove the .git hidden directory before you copy this template over to htdocs
The database credentials info are stored in app/config/app_config.php.
- Change the value of DB_NAME constant to reflect the name of the database to be used by your slim app.
- You may also want to change the database connection credentials in that file.
Do not use .env files for storing environment specific application settings/configurations. Dotenv is not meant to be used in production
Just Google: "DB_PASSWORD" filetype:env Google
Instead, follow the instructions that are detailed in config/env.example.php
The following dependencies have been already added to this template.
slim/slim:"4.*"guzzlehttp/guzzlevlucas/phpdotenvfirebase/php-jwtmonolog/monolog
Optional: you can use composer to either update the referenced dependencies or add additional ones based on your implementation's requirements.
Listed below are recommended VS Code extensions for Web development. However, most of them are already included in .vscode/extensions.json