Coder Social home page Coder Social logo

slim-api-template's Introduction

slim-api-template

This is a repository template based on Slim 4 Framework.

Features

Several features are already supported inside this repository template such as:

  • Validation using cakephp/validation combined with selective/validation to construct a nice exception middleware, thanks a lot to Daniel Opitz a.k.a odan.
  • ORM using cycle/orm with a simple database seeder provided. To make use the repository just simply get repository based on the entity for example $orm->getRepository(UserEntity::class).
  • Logger using monolog/monolog with supports for file and console logger.
  • Environment variables using vlucas/phpdotenv. The current settings support an overridden environment, simply make another env file for example .env.staging and add your staging environment to the default .env. The settings under the same environment key would be automatically replaced.
  • Unit Test using phpunit/phpunit with mocked database. If the tests getting bigger and more complex and furthermore it runs slower than before, preferably shifting to the mocked repositores and transactions approach. The service UserService is already testable, you can run composer test to see all the test case scenarios and all the output.
  • Beautiful swagger docs loaded with slim/php-view.

Screenshoot

screencapture-localhost-8000-docs-v1-2022-01-17-18_48_37

Usage

Basically, you want to set up your environment variables inside the .env file and then simply run a php command:

php -S localhost:<your_lovely_port_here> -t public/

If you want to run the database seeder, make sure that you've set up the initial data inside the resources\setup folder with the initialdata.json name to your appropriate database structur (according to your table(s) and column(s) name) and then run the following command:

php src/Supports/Seeder.php

If the seeding process is done, the success message would appear in your whatever runs the command in.

License

The slim-api-template is open-sourced template repository licensed based on Slim 4 Framework, under the MIT license.

slim-api-template's People

Contributors

latuconsinafr avatar

Stargazers

 avatar  avatar  avatar

Watchers

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