Giter VIP home page Giter VIP logo

slim4-gslim-skeleton's Introduction

SLIM 4 - API SKELETON

Useful framework for RESTful API development with JSON schema validation, using Slim PHP micro framework.

Used technologies: "PHP 7, Slim 4, MySQL, Doctrine, PHPUnit, dotenv & vagrant".

Software License

โš™๏ธ QUICK INSTALL:

Requirements:

  • Composer.
  • PHP 7.2+.
  • MySQL/MariaDB.
  • or Vagrant.

With Composer:

You can create a new project running the following commands:

$ composer create-project slim4/gslim-skeleton [my-app]

Configure your connection to MySQL Server:

By default, the API use a MySQL Database.

You should check and edit this configuration in your scr/Config/.env file:

APP_URL=http://yourproject.lo/
APP_DEBUG=true
APP_ID=1
APP_ENV=local

#Database
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=gslim
DB_USERNAME=vagrant
DB_PASSWORD=vagrant
DB_CHARSET=utf8
DB_COLLATION=utf8_unicode_ci
DB_PREFIX=


# Cache twig
CACHE=false

#LOG_PATH
LOG_PATH='storage/logs/app.log'

๐Ÿ“ฆ DEPENDENCIES:

LIST OF REQUIRE DEPENDENCIES:

  • slim/slim: Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
  • slim/psr7: PSR-7 implementation for use with Slim 4.
  • slim/csrf: Slim Framework CSRF Protection.
  • doctrine/orm: Object Relational Mapper.
  • justinrainbow/json-schema: JSON Schema for PHP.
  • vlucas/phpdotenv: Loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically.

LIST OF DEVELOPMENT DEPENDENCIES:

  • phpunit/phpunit: The PHP Unit Testing framework.
  • symfony/console: The Console component eases the creation of beautiful and testable command line interfaces

PHP Slim command line: $ php slim

  Slim Command Management Console 1.0

  Usage:
    command [options] [arguments]

  Options:
    -h, --help            Display help for the given command. When no command is given display help for the list command
    -q, --quiet           Do not output any message
    -V, --version         Display this application version
        --ansi            Force ANSI output
        --no-ansi         Disable ANSI output
    -n, --no-interaction  Do not ask any interactive question
    -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  Available commands:
    help              Display help for a command
    list              List commands
    migrate           Perform database migration

  make
    make:command      Create command file
    make:controller   Create interface controller
    make:entity       Create Entity e. g. UserAccess = tablename user_access
    make:exception    Create service interface
    make:middleware   Create Middleware
    make:migration    Create database migration file e. g. create_user_access_table / update_user_access_table
    make:service      Create service interface
    make:trait        Create interface trait
  migrate
    migrate:rollback  Roll back the database migration
  schedule
    schedule:run      Run timed task scheduling commands

๐Ÿ”– ENDPOINTS:

BY DEFAULT:

  • CSRF Token: GET /api/token

  • Health Check: GET /healthcheck

๐Ÿ˜Ž THAT'S IT!

Now go build a cool SLIM API.

slim4-gslim-skeleton's People

Contributors

gsuartana avatar

Stargazers

 avatar  avatar  avatar  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.