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 this repository as
.zip
file. - Extract the downloaded
slim-template-main.zip
file locally. - Copy the
slim-template-main
folder into your Web server's document root (that is,htdocs
) - Rename the
slim-template-main
folder to[project_name]-api
. For example,worldcup-api
- Open your
[project_name]-api
folder in VS Code - In the
.htaccess
file, change the specified subdirectory that is assigned to theRewriteBase
directive. The name of the subdirectory must be the same as the one you chose in Step 4). For example, change fromRewriteBase /slim-template
toRewriteBase /worldcup-api
- In
index.php
, change the applications's base path directory from$app->setBasePath("/slim-template");
to$app->setBasePath("/[project_name]-api");
where[project_name]
is the name of the subdirectory you chose in Step 4). - Run the following command to install or update the required dependencies in a VS Code terminal window (hit
Ctrl+`
)
composer.bat update
NOTE:
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.
The following dependencies have been already added to this template.
slim/slim:"4.*"
guzzlehttp/guzzle
vlucas/phpdotenv
firebase/php-jwt
monolog/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