A PHP-based MVC architecture backend system for managing 3C (Computer, Communication, Consumer Electronics) product sales, inventory, and customer service. This system provides a complete backend infrastructure for e-commerce operations specializing in electronics and technology products.
The project follows an MVC architecture with the following structure:
/app: Contains the main application code/Controllers: Controller classes handling HTTP requests/Models: Model classes for database operations
/core: Core framework classesRouter.php: Handles URL routingController.php: Base controller classDB.php: Database connection management
/public: Web-accessible filesindex.php: Application entry point.htaccess: URL rewriting rules
/routes: Route definitionsweb.php: Defines API routes
/database: Database setup scriptsinit.sql: Database initialization script
- PHP 7.4 or higher
- MySQL 5.7 or higher
- Apache web server with mod_rewrite enabled
- Composer (for dependency management)
-
Clone the repository to your web server directory:
git clone https://github.com/yourusername/3Cmanage.git -
Navigate to the project directory and install dependencies:
cd 3Cmanage composer install -
Create a database and run the initialization script:
mysql -u root -p < database/init.sql -
Create a
.envfile in the root directory based on the example:cp .env.example .envThen edit the
.envfile with your database credentials. -
Configure your web server to point to the
publicdirectory. -
Make sure the Apache mod_rewrite is enabled.
GET /products- View all products with specificationsGET /products/{id}- View a specific product with specsPOST /register- Register an accountPOST /login- Login to account
POST /logout- LogoutGET /my/addresses- List all addressesPOST /my/addresses- Add a new addressPUT /my/addresses/{id}- Update an addressDELETE /my/addresses/{id}- Delete an addressPOST /my/addresses/{id}/set-default- Set an address as defaultPOST /orders- Place a new orderGET /orders- View order historyGET /orders/{id}- View specific order detailsGET /my-devices- List all devices ownedGET /my-devices/warranty/{warrantyId}- Check warranty details for a device
GET /admin/products- List all productsPOST /admin/products- Add a new productGET /admin/products/{id}- View product detailsPUT /admin/products/{id}- Update a productDELETE /admin/products/{id}- Delete a productPOST /admin/products/{id}/adjust-stock- Manually adjust product stockGET /admin/products/{id}/inventory-logs- View product inventory logsGET /admin/orders- List all customer ordersGET /admin/orders/{id}- View specific order detailsPUT /admin/orders/{id}/status- Update order status
The 3C Management System provides the following key features:
- Browse and search products by various criteria
- View detailed product information and specifications
- Register for a customer account
- User authentication (login/logout)
- Address management (add, edit, delete, set default)
- Order placement and management
- Order history viewing
- Product warranty tracking
- Product management (add, update, delete products)
- Inventory management with change logging
- Order management and fulfillment
- Order status updates
The system is initialized with a default admin account:
- Username:
admin - Email:
admin@example.com - Password:
password
For detailed API documentation, see API_DOCS.md