Code Monkey home page Code Monkey logo

api-ddd-template's Introduction

api-ddd-template

  1. About project
  2. Installation
  3. Configure environment variables and create database
  4. Run project
  5. Run Tests
  6. Future improvements

About project

  • Symfony 4.4
  • Packages installed: Symfony Flex, Doctrine, Security, NelmioApiDocBundle, MakerBundle, DoctrineFixturesBundle and PHPUnit among others
  • DDD and Hexagonal architecture
  • Best practices: Clean code, PHP Standards Recommendations (PSR), SOLID principles and design patterns
  • Unit testing
  • Exceptions handler
  • Database full dump with test data included in migrations folder

Installation

Clone repository:

git clone https://github.com/burus86/api-ddd-template.git

Install dependencies:

cd api-ddd-template

composer install

Configure environmment variables and create database

Rename filename .env.dist as .env and edit DATABASE_URL value with database parameters

Execute the following commands to create an empty database with the name specified in .env filename:

php bin/console doctrine:database:create

php bin/console doctrine:schema:update --force

Execute the following command in order to dump fake data in database tables:

php bin/console doctrine:fixtures:load

Alternatively, you can either import the db-api-ddd-template-full.sql file, included in migrations folder, to create and populate the database schema, however this file might not be up to date.

Run project

Follow instructions to install a Symfony Local Web Server and then open a new tab with the following URL:

http://127.0.0.1:8000/api/doc

Alternatively, if you use XAMPP, open the URL:

http://localhost/api-ddd-template/public/api/doc

All API endpoints require a X-AUTH-TOKEN in header, with a value equal to field api_token in user table. Example: cU70Sbr0qKrUQHE0tw60XQVMwBP8hJrdRMY61xhX

Captura

Captura

Run Tests

vendor/bin/phpunit

Future improvements

api-ddd-template's People

Contributors

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