OneStore is a small custom PHP MVC e-commerce app with a storefront, cart, checkout flow, and admin panel.
This project does not use Composer for bootstrapping. The current setup flow is:
- Configure
.env - Run migrations
- Seed sample data
- Start the app
- PHP 8.1 or higher
- MySQL or MariaDB
- A web server such as Laragon, Apache, or the built-in PHP server
php-test/
|- app/
| |- Controllers/
| |- Helpers/
| |- Models/
| `- Views/
|- config/
|- database/
| |- migrations/
| |- seeders/
| |- migrate.php
| `- seed.php
|- public/
| |- assets/
| `- index.php
|- .env.example
|- index.php
`- README.md
Copy the example environment file:
Copy-Item .env.example .envThen update .env for your local setup.
Minimum values to check:
APP_ENV=development
APP_DEBUG=true
APP_URL=http://localhost:8000
BASE_PATH=
DB_HOST=localhost
DB_NAME=onestore_db
DB_USER=root
DB_PASS=
DB_CHARSET=utf8mb4Use values that match how you serve the project:
- Laragon at
http://localhost/php-test
APP_URL=http://localhost/php-test
BASE_PATH=/php-test- Laragon virtual host at
http://php-test.test
APP_URL=http://php-test.test
BASE_PATH=- PHP built-in server at
http://localhost:8000
APP_URL=http://localhost:8000
BASE_PATH=The migration runner creates the database automatically if it does not exist.
Run all pending migrations:
php database/migrate.phpReset everything and rebuild the schema from scratch:
php database/migrate.php freshRollback the most recent migration batch:
php database/migrate.php rollbackCurrent migrations create these tables:
tbl_admintbl_brandtbl_categorytbl_producttbl_customertbl_ordertbl_order_itemtbl_slidertbl_cart
Run all seeders:
php database/seed.phpRun a single seeder:
php database/seed.php Admin
php database/seed.php Brand
php database/seed.php Category
php database/seed.php Customer
php database/seed.php ProductAvailable seeders:
AdminSeederBrandSeederCategorySeederCustomerSeederProductSeeder
Recommended first-time setup:
php database/migrate.php fresh
php database/seed.php- Put the project in
C:\laragon\www\php-test - Start Apache and MySQL in Laragon
- Set
.envto match your URL - Open one of these URLs:
http://localhost/php-testhttp://php-test.test
From the project root, run:
php -S localhost:8000 -t publicThen open:
http://localhost:8000
Admin accounts:
-
Username:
admin -
Password:
admin123 -
Username:
manager -
Password:
admin123
Sample customer accounts:
-
Email:
test@example.com -
Password:
password123 -
Email:
john.doe@example.com -
Password:
password123
Admin URL:
/admin
Examples:
http://localhost/php-test/adminhttp://php-test.test/adminhttp://localhost:8000/admin
- Use the migration and seeder scripts as the source of truth instead of the older SQL dump files.
- Uploaded files are stored under
public/uploads/. - Static assets are served from
public/assets/. - If routes or assets look broken, double-check
APP_URLandBASE_PATHin.env.