Giter Club home page Giter Club logo

slim-template's Introduction

Slim-Based Application Skeleton

This repository contains an application skeleton for creating REST-based Web services. The latest version of the Slim micro framework is being used.

How Do I Use/Deploy this Template?

Follow the instructions below in the specified order:

  1. Download this repository as .zip file.
  2. Extract the downloaded slim-template-main.zip file locally.
  3. Copy the slim-template-main folder into your Web server's document root (that is, htdocs)
  4. Rename the slim-template-main folder to [project_name]-api. For example, worldcup-api
  5. Open your [project_name]-api folder in VS Code
  6. 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 (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

How Do I Connect to a Database?

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.

On Using Environment Variables

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

Useful VS Code Keybindings

Below are keybindings that speeds up the insertion of special characters and keywords while editing a .php file. These bindings need to be added to your VS Code's keybindings.json

 {
    "key": "alt+shift+j",
    "command": "type",
    "args": { "text": "=>" },
    "when": "editorTextFocus"
  },
  {
    "key": "alt+shift+i",
    "command": "type",
    "args": { "text": "[" },
    "when": "editorTextFocus"
  },
  {
    "key": "alt+shift+h",
    "command": "type",
    "args": { "text": "<?php" },
    "when": "editorTextFocus"
  },
  {
    "key": "alt+shift+l",
    "command": "type",
    "args": { "text": "$this->" },
    "when": "editorTextFocus"
  },
  {
    "key": "alt+shift+k",
    "command": "type",
    "args": { "text": "->" },
    "when": "editorTextFocus"
  },
  {
    "key": "shift+enter",
    "command": "type",
    "args": { "text": "$" },
    "when": "editorTextFocus"
  },
  {
    "key": "shift+space",
    "command": "type",
    "args": { "text": "_" },
    "when": "editorTextFocus"
  }

Dependencies

The following dependencies have been already added to this template.

  1. slim/slim:"4.*"
  2. guzzlehttp/guzzle
  3. firebase/php-jwt
  4. monolog/monolog

Optional: you can use composer to either update the referenced dependencies or add additional ones based on your implementation's requirements.

VS Code Extensions

Listed below are recommended VS Code extensions for Web development. However, most of them are already included in .vscode/extensions.json

PHP, HTML, and JavaScript

  1. Thunder Client
  2. Path Intellisense
  3. GitLens โ€” Git supercharged
  4. PHP IntelliSense
  5. PHP Intelephense
  6. PHP Debug
  7. PHP Extension Pack
  8. ESLint
  9. JavaScript (ES6) code snippets
  10. HTML Snippets

Markdown

  1. Markdown All in One
  2. markdownlint
  3. Markdown Preview Github Styling
  4. Markdown PDF

Productivity

  1. Code Spell Checker
  2. Bookmarks

Appearance

  1. Material Icon Theme

Dark Themes

  1. Evondev Dracula
  2. Tokyo Night
  3. Dracula Official

slim-template's People

Contributors

frostybee avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.