A tiny inventory app to demonstrate PHP/Laravel + Bootstrap + Ajax.
- Form: Product name, Quantity in stock, Price per item
- Ajax submit (no page reload)
- Table ordered by Datetime submitted
- Per-row Total value = quantity × price
- Footer sum of all Totals
- Edit and Delete each line via Ajax
- Download JSON (
storage/app/data.json)
- Laravel 11, PHP 8.2+
- Bootstrap 5
- No database — data is persisted to a JSON file for zero-config spin-up
- PHP ≥ 8.2 and Composer installed
# install dependencies
composer install
# set up env and app key
cp .env.example .env
php artisan key:generate
# start dev server
php artisan serve
# open http://127.0.0.1:8000
Endpoints
GET / — UI
GET /products — list (JSON)
POST /products — create
PUT /products/{id} — update
DELETE /products/{id} — delete
GET /export — download JSON
Data File
Path: storage/app/data.json
Format: array of objects
[
{
"id": "uuid",
"product_name": "Widget",
"quantity": 2,
"price": 10.5,
"datetime_submitted": "2025-10-06T12:00:00Z",
"total_value": 21.0
}
]
Notes
All create/update/delete actions are done via Ajax; the footer shows a live sum of all Total value cells.
To reset the app, you can clear storage/app/data.json and put [].
License
MIT
If you want me to add screenshot placeholders or a short “Implementation details” section, say the word and I’ll extend it.