{"id":25171438,"url":"https://github.com/basemax/onlinemarketplacephp","last_synced_at":"2025-05-05T20:44:58.429Z","repository":{"id":165466979,"uuid":"630915625","full_name":"BaseMax/OnlineMarketplacePHP","owner":"BaseMax","description":"An online marketplace that allows users to buy and sell products. Users can register for an account, browse products, add products to their cart, and checkout using a payment gateway. Sellers can create and manage their own product listings, including setting the price, description, and uploading product images.","archived":false,"fork":false,"pushed_at":"2024-08-24T21:58:30.000Z","size":103,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-04T21:45:45.352Z","etag":null,"topics":["api","api-php","api-rest","marketplace","marketplace-api","marketplace-php","mvc","mvc-architecture","php","php-api","php8","restful","restful-api","restful-webservices"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-21T13:04:04.000Z","updated_at":"2025-01-29T09:42:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c47dce4-5f86-4898-8d35-24a4042d347d","html_url":"https://github.com/BaseMax/OnlineMarketplacePHP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FOnlineMarketplacePHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FOnlineMarketplacePHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FOnlineMarketplacePHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FOnlineMarketplacePHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/OnlineMarketplacePHP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252574162,"owners_count":21770351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-php","api-rest","marketplace","marketplace-api","marketplace-php","mvc","mvc-architecture","php","php-api","php8","restful","restful-api","restful-webservices"],"created_at":"2025-02-09T09:20:22.114Z","updated_at":"2025-05-05T20:44:58.409Z","avatar_url":"https://github.com/BaseMax.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Online Marketplace PHP\n\nAn online marketplace that allows users to buy and sell products. Users can register for an account, browse products, add products to their cart, and checkout using a payment gateway. Sellers can create and manage their own product listings, including setting the price, description, and uploading product images. Admins can manage user accounts, product listings, and orders.\n\n## Requirements\n\n- User registration and login with password hashing\n- User roles: **buyer**, **seller**, and **admin**\n- Sellers can create and manage their own product listings\n- Product listings include title, description, price, category, and images\n- Users can browse products by category and search for products by keyword\n- Users can add products to their cart and checkout using a payment gateway (e.g., PayPal)\n- Orders are tracked and stored in a database\n- Admins can manage user accounts, product listings, and orders\n- Proper use of security measures, such as input validation, SQL injection prevention, and CSRF protection\n- Efficient use of caching mechanisms, such as Redis or Memcached, to improve performance\n- Use of an MVC architecture (Not Laravel or CodeIgniter)\n\n## API Routes\n\n### Authentication:\n\n- `POST /api/login`: Authenticate user and generate access token\n\n```console\n{\n    \"JWT_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\",\n    \"email\": \"ali@gmail.com\",\n    \"password\": \"$2y$10$ChXlwPFkN6U/YCTQikrYeu4pRlxx6ZLe.mj0mKwkQC/UJLjfYMsZa\"\n }\n```\n\n- `POST /api/register`: Register a new user account\n\n```console\n{\n    \"id\": 1,\n    \"name\": \"ali\",\n    \"email\": \"ali@gmail.com\",\n    \"password\": \"$2y$10$ChXlwPFkN6U/YCTQikrYeu4pRlxx6ZLe.mj0mKwkQC/UJLjfYMsZa\",\n    \"remember_token\": \"sskjdh2fudn1\"\n}\n```\n\n### Products:\n\n- `GET /api/products`: Retrieve all products\n- `GET /api/products/{id}`: Retrieve a specific product by ID\n- `POST /api/products`: Create a new product listing\n- `PUT /api/products/{id}`: Update a product listing\n- `DELETE /api/products/{id}`: Delete a product listing\n\n### Orders:\n\n- `GET /api/orders`: Retrieve all orders\n- `GET /api/orders/{id}`: Retrieve a specific order by ID\n- `POST /api/orders`: Create a new order\n- `PUT /api/orders/{id}`: Update an existing order\n- `DELETE /api/orders/{id}`: Delete an order\n\n### Users:\n\n- `GET /api/users`: Retrieve all users\n- `GET /api/users/{id}`: Retrieve a specific user by ID\n- `PUT /api/users/{id}`: Update a user account\n- `DELETE /api/users/{id}`: Delete a user account\n\n### Categories:\n\n- `GET /api/categories`: Retrieve all categories\n- `GET /api/categories/{id}`: Retrieve a specific category by ID\n- `POST /api/categories`: Create a new category\n- `PUT /api/categories/{id}`: Update a category\n- `DELETE /api/categories/{id}`: Delete a category\n\n### Payments:\n\n- `POST /api/payments`: Process payment using payment gateway (With a good structure that allows us to add more gateways in the future)\n\nExample Response:\n\n```console\n{\n    \"payment_uri\": \"https://nextpay.org/nx/gateway/payment/267a5387-af3a-4063-8d41-87df73f38f60\",\n    \"trans_id\": \"267a5387-af3a-4063-8d41-87df73f38f60\"\n}\n```\n\nNote: This is just an example, and you may need to modify the routes and methods based on the specific requirements.\n\n## Database Schema\n\n### Users\n\n- `id`: int (primary key)\n- `name`: varchar(255)\n- `email`: varchar(255)\n- `password`: varchar(255)\n- `remember_token`: varchar(100)\n- `role`: enum('buyer', 'seller', 'admin')\n- `created_at`: timestamp\n- `updated_at`: timestamp\n\n### Categories\n\n- `id`: int (primary key)\n- `name`: varchar(255)\n- `created_at`: timestamp\n- `updated_at`: timestamp\n\n### Products\n\n- `id`: int (primary key)\n- `title`: varchar(255)\n- `description`: text\n- `price`: decimal(8,2)\n- `category_id`: int (foreign key to Categories table)\n- `seller_id`: int (foreign key to Users table)\n- `created_at`: timestamp\n- `updated_at`: timestamp\n\n### Orders\n\n- `id`: int (primary key)\n- `buyer_id`: int (foreign key to Users table)\n- `product_id`: int (foreign key to Products table)\n- `quantity`: int\n- `amount`: decimal(8,2)\n- `status`: enum('pending', 'completed', 'cancelled')\n- `created_at`: timestamp\n- `updated_at`: timestamp\n\n### Payments\n\n- `id`: int (primary key)\n- `order_id`: int (foreign key to Orders table)\n- `amount`: decimal(8,2)\n- `status`: enum('pending', 'completed', 'failed')\n- `payment_gateway`: varchar(255)\n- `transaction_id`: varchar(255)\n- `created_at`: timestamp\n- `updated_at`: timestamp\n\n## Evaluation Criteria\n\n- Correctness and completeness of the implementation\n- Efficient use of caching mechanisms\n- Proper use of security measures\n- Clean and maintainable code\n- Proper use of error handling and logging\n- Good coding practices, such as adherence to coding standards and proper documentation\n\n## Installation\n\nFirst step, You need to clone this repository from GitHub to your local environment:\n\n```console\ngit clone https://github.com/BaseMax/OnlineMarketplacePHP.git\n```\n\nNow you must run some command to install dependecies and create .env file:\n\n```console\ncomposer install\n```\n```console\ncp .env.example .env\n```\n\nNow open `.env` file and fill the things that are needed.\n\nNavigate to `public` folder and run below command to start serving on the localhost:\n\n```console\nphp -S localhost:5000\n```\n\n## Authors\n\n- Ali Ahmadi\n- Max Base\n\nCopyright 2023, Max Base\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fonlinemarketplacephp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Fonlinemarketplacephp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fonlinemarketplacephp/lists"}