Coder Social home page Coder Social logo

basemax / ecommercephpddd Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 2.0 1004 KB

Welcome to the Domain-Driven Design (DDD) PHP 8.2 Ecommerce System! This project aims to provide a robust and scalable Restful API-based ecommerce system using PHP 8.2, all without relying on Laravel or any other third-party project. This README will guide you through the setup, architecture, and usage of the system.

License: GNU General Public License v3.0

PHP 97.21% Hack 2.79%
ddd ddd-php ecommerce ecommerce-api ecommerce-application ecommerce-site ecommerce-store ecommerce-website php php-ddd

ecommercephpddd's Introduction

Domain-Driven Design (DDD) PHP 8.2 Ecommerce System

Welcome to the Domain-Driven Design (DDD) PHP 8.2 Ecommerce System! This project aims to provide a robust and scalable ecommerce system using PHP 8.2, all without relying on Laravel or any other third-party project. This README will guide you through the setup, architecture, and usage of the system.

Introduction

The DDD PHP 8.2 Ecommerce System is designed with a focus on Domain-Driven Design principles. It provides a solid foundation for building a flexible and maintainable ecommerce solution, emphasizing separation of concerns and modularity.

Features

  • Domain-Driven Design: The system adheres to DDD principles, helping you create a clear and structured architecture for your ecommerce application.
  • PHP 8.2: Utilize the latest features and enhancements provided by PHP 8.2 for improved performance and maintainability.
  • Modular Design: The architecture promotes modularization, making it easier to add, update, or replace specific components of the system.
  • Custom ORM: Implement a simple Object-Relational Mapping (ORM) tailored to the needs of the ecommerce domain.

Architecture

The architecture of the DDD PHP 8.2 Ecommerce System follows a layered approach, separating concerns and promoting a clear division of responsibilities. The main layers are:

  • Presentation Layer: Handles user interaction, including handling HTTP requests and responses.
  • Application Layer: Orchestrates the interaction between the Presentation and Domain layers. Contains application services and use cases.
  • Domain Layer: Contains the core business logic and domain entities. This layer is the heart of the application and should be independent of other layers.
  • Infrastructure Layer: Provides implementations for external dependencies such as databases, HTTP clients, and third-party integrations.

Screenshots

screenshot1 screenshot2 screenshot3

Getting Started

Prerequisites

  • PHP 8.2 or higher
  • Composer
  • Mysql

Installation

  • Clone this repository: git clone https://github.com/BaseMax/EcommercePHPDDD.git
  • Go to project directory: cd EcommercePHPDDD
  • Install dependencies: composer install
  • Setup mysql database tables: you can either use sql code below or use sql backup database.sql
  • Edit .env file with your own values
  • (optionaly) Seed the database: cd app/Infrastructure/Database/ && php MysqlSeeder.php
  • Run the server: cd public/ && php -S localhost:8000
  • App is running on http://localhost:8000

Mysql Tables SQL Code

products

CREATE TABLE IF NOT EXISTS products (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    price INT NOT NULL
);

orders

CREATE TABLE IF NOT EXISTS orders (
    id INT AUTO_INCREMENT PRIMARY KEY,
    address TEXT NOT NULL,
    total_price INT NOT NULL,
    status VARCHAR(255) NOT NULL
);

order_products

CREATE TABLE IF NOT EXISTS order_products (
    id INT AUTO_INCREMENT PRIMARY KEY,
    order_id INT NOT NULL,
    product_id INT NOT NULL,
    quantity INT NOT NULL,
    FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE CASCADE,
    FOREIGN KEY (product_id) REFERENCES products(id) ON DELETE CASCADE
);

payments

CREATE TABLE IF NOT EXISTS payments (
    id INT AUTO_INCREMENT PRIMARY KEY,
    order_id INT NOT NULL,
    idpay_id VARCHAR(255) NOT NULL,
    link VARCHAR(255) NOT NULL,
    amount INT NOT NULL,
    status INT NOT NULL,
    track_id INT NOT NULL,
    FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE CASCADE
);

Contributing

Contributions to this project are welcome! Feel free to fork the repository, make changes, and submit pull requests. Please follow the established coding guidelines and keep the DDD principles in mind.

License

This project is licensed under the GPL-3.0 License.

Copyright 2023, Max Base

ecommercephpddd's People

Contributors

joubeh avatar

Stargazers

 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.