How godunme/barcode_scanner works
This PHP barcode-scanner app lets shoppers scan or browse products, look up prices, and maintain a cart; administrators authenticate to manage products, categories, and product images. The visible PHP APIs delegate product, category, and user operations to models backed by MySQL, while upload endpoints manage files in uploads/. The README documents the product capabilities; client-to-API wiring is not visible in the sampled JavaScript, so those links are marked unverified.
Main entry points: admin.js Admin interactions · functions.php Request and security helpers · categories.php Categories API · products.php Products API
Components 17
Shopper experience
- Scanner page
index.php - Scanner and cart
js/app.js
Administration
- Admin page
admin/index.php - Admin interactions
admin/admin.js
HTTP APIs
- Authentication API
api/auth.php - Products API
api/products.php - Categories API
api/categories.php - Image upload API
api/upload.php - Image deletion API
api/delete_upload.php
Domain models
- Product model
models/Product.php - Category model
models/Category.php - User model
models/User.php
Persistence and files
- Request and security helpers
includes/functions.php - MySQL connection
config/database.php - Uploaded images
uploads
Other components
- Shopper
- Administrator
Connections 26
- Shopper → Scanner page: uses
README.md - Scanner page → Scanner and cart: loads
index.php - Scanner and cart → Products API: requests products
- Scanner and cart → Categories API: requests categories
- Administrator → Admin page: uses
README.md - Admin page → Admin interactions: loads interactions
- Admin interactions → Authentication API: requests authentication
- Admin interactions → Products API: requests product CRUD
- Admin interactions → Categories API: requests category CRUD
- Admin interactions → Image upload API: uploads images
- Admin interactions → Image deletion API: deletes images
- Authentication API → User model: authenticates users
api/auth.php - Authentication API → Request and security helpers: checks sessions and CSRF
api/auth.php - Products API → Product model: handles product operations
api/products.php - Products API → Request and security helpers: validates requests
api/products.php - Categories API → Category model: handles category operations
api/categories.php - Categories API → MySQL connection: checks category table
api/categories.php - Categories API → Request and security helpers: checks request source
api/categories.php - Image upload API → Request and security helpers: checks access and CSRF
api/upload.php - Image upload API → Uploaded images: writes images
api/upload.php - Image deletion API → Request and security helpers: checks access and CSRF
api/delete_upload.php - Image deletion API → Uploaded images: removes images
api/delete_upload.php - Product model → MySQL connection: reads and writes
models/Product.php - User model → MySQL connection: reads and writes
models/User.php - User model → Request and security helpers: generates user IDs
models/User.php - Product model → Request and security helpers: loads shared helpers
models/Product.php