A complete CRUD app, authentication and security, Composer and REST APIs, then capstone projects, deployment and your career.
17
Building a CRUD Web App
10 examples • 5 h
18
Authentication & Security
10 examples • 5 h
19
Composer, REST APIs & Testing
10 examples • 5 h
20
Capstone Projects, Deployment & Career
10 examples • 5 h
🐘
<?php
PHP 8.3 • MySQL • XAMPP
BrainBit Infotech, Ranchi | Complete PHP 8.3 Course | Keys: ← → navigate M menu L Code Lab F fullscreen
M17
Building a CRUD Web App
Everything so far comes together: a complete Student Management System with list, add, edit, delete, search, pagination, validation, flash messages, CSV export and a mini MVC structure.
Planning pages, tables and flow
Project structure and a bootstrap file
List, Create, Edit, Delete (CRUD)
Shared validation and form partials
Search, pagination and CSV export
The MVC idea: models, views, controllers
YOU WILL BUILD: Student Management SystemCSV exportMini MVC framework
💻
Part 5 • about 5 hours 10 practice examples: 5 Easy • 3 Medium • 2 Hard
How the examples workExamples 1-8 build this app step by step; every run resets the database to the same 8 students. Example 9 reorganises it as mini-MVC and Example 10 is the complete system.
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Animated explainer
The CRUD cycle
C
Create
form → INSERT
create.php
R
Read
SELECT → table
index.php
U
Update
load row → form → UPDATE
edit.php?id=3
D
Delete
confirm → POST → DELETE
delete.php?id=3
POST form➤validate➤SQL (prepared)➤flash("Saved")➤302 → index.php➤list shows message
Deleting with a GET link is dangerousBrowsers and bots pre-load links. A link should only show a confirmation page; the actual delete happens on POST.
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Animated explainer
MVC: Model, View, Controller
💻
Browser
➤
ControllerStudentController::index() decides what to do
⇄
ModelStudent::all(), find(), save() talks to MySQL
➤
Viewviews/students/index.php only HTML + <?= ?>
WhyEach file has one job. Designers edit views, database changes stay in models, and controllers stay short. Laravel, CodeIgniter and Symfony all follow MVC.
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Practice 1 of 10 • Easy
Example 1: bootstrap.php: the shared start file
● Easy💼 Real project: The first file of every PHP project
One file that every page requires: session, database connection (created once), escaping helper, flash messages and redirect. never is the return type of a function that always exits.
test.phpbootstrap.php
REAL RUN
✍ Try it yourself Add a helper old(string $field) that returns the escaped POST value or an empty string.
function old(string $f): string { return e($_POST[$f] ?? ''); }
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Practice 2 of 10 • Easy
Example 2: List students page
● Easy💼 Real project: The "index" screen of admin panels
A JOIN brings the course name, the layout comes from header/footer, and every value is escaped with e().
index.phpbootstrap.phpheader.phpfooter.php
REAL RUN
✍ Try it yourself Show the date each student was added (created_at) in d-m-Y format.
Select s.created_at and print date('d-m-Y', strtotime($r['created_at'])).
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Practice 3 of 10 • Easy
Example 3: Add student form
● Easy💼 Real project: Admission and registration screens
GET shows an empty form; POST validates, INSERTs, sets a flash message and redirects to the list (PRG). Validation and the form are shared files, used again by Edit.
✍ Try it yourself Add a "last updated" column that is set with NOW() on every update.
ALTER TABLE students ADD updated_at DATETIME NULL; and add updated_at = NOW() to the UPDATE.
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Practice 5 of 10 • Easy
Example 5: Delete with confirmation
● Easy💼 Real project: Safe deletion in admin panels
The Delete link only shows a confirmation page. The row is deleted only when the form is POSTed. After deleting, the flash message appears on the list.
✍ Try it yourself Make it a "soft delete": set deleted_at instead of deleting, and hide those rows in the list.
ALTER TABLE ADD deleted_at DATETIME NULL; UPDATE ... SET deleted_at = NOW(); list with WHERE deleted_at IS NULL.
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Practice 6 of 10 • Medium
Example 6: Search + pagination
● Medium💼 Real project: Lists with hundreds of records
One query with LIKE for search, LIMIT and OFFSET for pages, and a COUNT(*) with the same filter for the page count. Links keep the search text.
index.phpbootstrap.phpheader.phpfooter.php
REAL RUN
✍ Try it yourself Add a course filter (select box) that works together with the search box.
Add AND (:cid = 0 OR s.course_id = :cid) to $where and keep cid in the links.
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Practice 7 of 10 • Medium
Example 7: Validation + flash messages (the full add flow)
● Medium💼 Real project: Every data-entry screen
Walk through the full flow with the Database tab open: invalid data is rejected with messages, valid data is saved, the redirect shows the flash once, and a refresh shows the list without it.
✍ Try it yourself Show the number of students per course above the table.
SELECT c.name, COUNT(s.id) FROM courses c LEFT JOIN students s ... GROUP BY c.id.
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Practice 8 of 10 • Medium
Example 8: Export to CSV
● Medium💼 Real project: "Download Excel" buttons in reports
Stream rows from MySQL straight into the download with fputcsv on php://output. The BOM line makes Excel read Hindi and other Unicode text correctly.
export.phpbootstrap.phpheader.phpfooter.php
REAL RUN
✍ Try it yourself Export only the students of one course: export.php?course=2.
Add WHERE s.course_id = ? with a prepared statement when the parameter is present.
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Practice 9 of 10 • Hard
Example 9: Mini MVC structure
● Hard💼 Real project: Understanding Laravel and CodeIgniter
The same app as tiny MVC: index.php is the front controller, StudentController handles actions, the Student model holds all SQL, and views contain only HTML.
✍ Try it yourself Add a route courses with a CourseController and a view.
Create app/Course.php (model), app/CourseController.php and views/courses/index.php; add one match arm.
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M17Practice 10 of 10 • Hard
Example 10: Complete Student Management System
● Hard💼 Real project: A deliverable project for a coaching centre client
All the pieces in one app: list with search, add, edit, delete with confirmation, flash messages and CSV export. Follow the full journey in the Browser tab and the final table in the Database tab.
✔Shared validation and form partials keep add and edit identical.
✔Search with LIKE, paginate with LIMIT/OFFSET, export with fputcsv to php://output.
✔MVC: controllers coordinate, models hold SQL, views hold HTML.
🏆
Module 17 complete!
You practised 10 real examples.
👉 Coming next
M18 Authentication & Security: real user accounts with hashed passwords, roles, CSRF tokens and login limits.
Complete PHP 8.3 Course | Part 5 | Building a CRUD Web App
M18
Authentication & Security
Every real app has users. You will build registration and login the right way: hashed passwords, safe sessions, roles, CSRF protection, login limits and password reset, plus a checklist of the top web attacks.
Neveruse md5() or sha1() for passwords; they are far too fast to brute force. password_hash is slow on purpose and handles the salt for you. Use VARCHAR(255) for the column.
● Easy💼 Real project: Changing how a legacy app stores passwords
An old app stored plain passwords. This one-time script converts them to hashes; afterwards login uses password_verify. The Database tab shows the result.
migrate.php
REAL RUN
✍ Try it yourself Add password_needs_rehash to a login function so hashes are upgraded automatically.
After a successful verify: if (password_needs_rehash($hash, PASSWORD_DEFAULT)) { update with a new password_hash($typed, ...) }
Validate, check the email is not taken, hash the password, INSERT with the default role "student", then log the user in. The Database tab shows only a hash.
register.phpauth.php
REAL RUN
✍ Try it yourself Add a "confirm password" field.
Compare $_POST['password'] with $_POST['confirm'] and add an error if different.
Look up the user by email, verify the hash, regenerate the session id, store minimal user info. Wrong email and wrong password give the same message so attackers cannot discover which emails exist.
login.phpdashboard.phpauth.php
REAL RUN
✍ Try it yourself Log in as tirkey@brainbit-teaching.com with Staff@2026. What role is shown?
● Medium💼 Real project: Admin / staff / student permissions
The admin page calls requireRole('admin'). A student gets 403 Forbidden even if she types the URL directly: hiding the menu link is not security; the server check is.
admin.phplogin.phpdashboard.phplogout.phpauth.php
REAL RUN
✍ Try it yourself Make a teacher-only page marks.php that admins can also open.
● Medium💼 Real project: Stopping password-guessing bots
Each failed login is recorded. After 3 failures for an email in 10 minutes, further attempts are blocked, even with the right password, until the window passes.
login.phpauth.php
REAL RUN
✍ Try it yourself Also limit by IP address: at most 10 failures per IP in 10 minutes.
Run a second COUNT(*) query WHERE ip = ? and block when it reaches 10.
A random token is created, only its hash is stored with a 30-minute expiry, and the reset link would be emailed (here it is shown on screen for the demo). The token works once, then is deleted.
forgot.phpreset.phpshow-link.phpauth.php
REAL RUN
✍ Try it yourself Why store hash('sha256', $token) instead of the token itself?
If the database leaks, stored hashes cannot be used as reset links. Only the email has the real token.
● Hard💼 Real project: The login module of a school or business portal
All parts together: login, dashboard, role-protected admin page, CSRF-protected profile form and logout, on the same users table. Follow the journey of a staff user.
Professional PHP: Composer for autoloading and packages, REST APIs that serve JSON to mobile apps and JavaScript front-ends, and automated tests that prove your code works.
Composer, composer.json and PSR-4 autoloading
Packages from Packagist (overview)
REST: resources, methods, status codes, JSON
A front-controller API with routing
Validation errors, API keys, pagination
Testing: assertions, a tiny test runner and PHPUnit
YOU WILL BUILD: Courses REST APIProducts API with MySQLTest suite for a GST calculator
🚀
Part 5 • about 5 hours 10 practice examples: 5 Easy • 3 Medium • 2 Hard
● Easy💼 Real project: Starting every modern PHP project
A composer.json with PSR-4 autoloading; composer dump-autoload generates the loader. Adding a class is now just: create the file in src/ with the right namespace.
The app sends JSON; the API validates the JSON (with PHP 8.3's json_validate inside body()), saves it and answers 201 Created with a Location header for the new resource.
index.phpcourses.json
REAL RUN
✍ Try it yourself Reject a new course whose name already exists with status 409 Conflict.
if (in_array(strtolower($new['name']), array_map('strtolower', array_column($courses, 'name')))) respond([...], 409);
PUT updates only the allowed fields (array_intersect_key ignores anything else, like a fake "id"). DELETE answers 204 with an empty body. The Files tab shows courses.json after the calls.
● Medium💼 Real project: Infinite scroll lists in apps
Query parameters control the result: ?q= search, ?page= and ?per_page= (capped at 50). The response includes meta so the app knows how many pages exist.
index.php
REAL RUN
✍ Try it yourself Add ?sort=price and ?sort=-price (descending), allowing only known columns.
Map ['price' => 'price ASC', '-price' => 'price DESC'] and put the mapped value into ORDER BY (never the raw input).
● Hard💼 Real project: Back end of an e-commerce app
A complete small API: list, show, create (validated), update stock, delete, with a tiny router that matches method + path pattern with regex. Every query is prepared. The Database tab shows the table after all calls.
index.php
REAL RUN
✍ Try it yourself Add GET /api/products/low-stock that lists products with stock below 10.
Add a route ['GET', '#^/api/products/low-stock$#', ...] BEFORE the (\d+) route, with WHERE stock < 10.
● Hard💼 Real project: Testing billing rules before release
A minimal test framework in 30 lines: test functions, assertions, exception tests and a summary with an exit code (CI servers fail the build on a non-zero code). One test fails on purpose to show what a failure looks like; the fix is the task.
Gst.phptests.php
REAL RUN
✍ Try it yourself The last test fails on purpose. Work out the right total by hand and fix the expected value.
999 x 12% = 119.88, so the total is 1118.88. The code is right and the test is wrong: change 1118.8 to 1118.88 and all 7 pass (exit code 0).
Time to build something real. Pick a capstone project, plan it, put it on Git, deploy it to real hosting, and plan your next steps as a PHP developer in Jharkhand, Bihar or remotely.
Choosing and planning a project
Git, GitHub and a good README
Deploying to shared hosting (cPanel) and a VPS
Production settings and a go-live checklist
Next step: Laravel
Career roadmap and your certificate
YOU WILL BUILD: 10 mini projects to extendYour own portfolio projectYour course certificate
🎓
Part 5 • about 5 hours 10 practice examples: 5 Easy • 3 Medium • 2 Hard
SSL/TLS Status → run AutoSSL (free). Redirect http to https.
8
Test + backup
Test every page with real logins. Schedule database backups (cron / cPanel Backup).
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Deployment
Go-live checklist and going further
Before you give the link to a client
HTTPS works; http redirects to https
display_errors Off; errors go to a log file
No test accounts with weak passwords; admin password changed
All forms: validation, CSRF token, escaped output
All queries prepared; DB user has only needed rights
Uploads checked; uploads folder cannot run PHP
Daily database backup and a tested restore
Timezone Asia/Kolkata; dates look right
Works on a mobile phone
VPS (more control)
A VPS (cloud server) runs Ubuntu with Nginx or Apache + PHP-FPM 8.3 + MySQL. You manage updates, firewall and backups yourself. Used for bigger apps and Laravel projects.
Next: Laravel
Laravel gives you routing, Eloquent ORM (models), Blade templates, migrations, validation, auth scaffolding and queues. Everything you built by hand in M17-M19 maps directly to a Laravel feature, which makes it easy to learn now.
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Practice 1 of 10 • Easy
Example 1: Personal portfolio with contact form
● Easy💼 Real project: Your own website for jobs and freelancing
A one-page portfolio: projects come from an array (later from MySQL), and the contact form validates and saves messages with PRG.
index.php
REAL RUN
✍ Try it yourself Add a "Download CV" link and a skills section with progress bars.
Skills array => percent; print
.
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Practice 2 of 10 • Easy
Example 2: Notice board
● Easy💼 Real project: School and society notice boards
Notices stored in a JSON file: newest first, important ones highlighted, and a small add form for the office (escape on output).
notices.phpnotices.json
REAL RUN
✍ Try it yourself Add an expiry date: hide notices older than 30 days.
Store a Y-m-d date and filter with strtotime($n['date']) >= strtotime('-30 days').
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Practice 3 of 10 • Easy
Example 3: To-do list (sessions)
● Easy💼 Real project: Personal task apps
Tasks live in the session: add, mark done and clear completed. Each action is a POST followed by a redirect.
todo.php
REAL RUN
✍ Try it yourself Save tasks in a MySQL table so they survive closing the browser.
Create a tasks table (id, text, done) and replace the session array with SELECT / INSERT / UPDATE.
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Practice 4 of 10 • Easy
Example 4: Online quiz
● Easy💼 Real project: Practice tests for schools and coaching
Questions from an array, one form, instant scoring with the correct answers shown. Shuffle the options so neighbours cannot copy positions.
quiz.php
REAL RUN
✍ Try it yourself Load questions from a MySQL table and save each student's score with the date.
Tables questions(id, text, opt_a..opt_c, answer) and attempts(student, score, taken_at).
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Practice 5 of 10 • Easy
Example 5: Guestbook (MySQL)
● Easy💼 Real project: Visitor feedback on event or tourism sites
A first MySQL project: one table, a form with validation, a prepared INSERT and a list of the latest entries.
guestbook.php
REAL RUN
✍ Try it yourself Add a star rating (1-5) and show the average rating at the top.
Add a rating TINYINT column, a select box, and SELECT AVG(rating).
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Practice 6 of 10 • Medium
Example 6: Library management
● Medium💼 Real project: School and college libraries
Issue and return with rules enforced in SQL: a book must be available, a member may hold at most 2 books, and a fine of Rs 2/day is charged after 14 days. Each action is checked and recorded.
library.php
REAL RUN
✍ Try it yourself Add a report of members with unpaid fines.
SELECT member_id, SUM(fine) FROM loans WHERE fine > 0 AND paid = 0 GROUP BY member_id.
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Practice 7 of 10 • Medium
Example 7: Hostel / PG booking
● Medium💼 Real project: Hostel, PG and guest-house booking
A booking is accepted only if the bed is free for the requested dates. The overlap test start < other_end AND end > other_start runs inside a transaction with FOR UPDATE so two people cannot book the same bed at the same moment.
book.php
REAL RUN
✍ Try it yourself Add a function that lists free beds for a date range.
SELECT id FROM beds WHERE id NOT IN (SELECT bed_id FROM bookings WHERE check_in < :to AND check_out > :from).
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Practice 8 of 10 • Medium
Example 8: E-commerce cart with checkout
● Medium💼 Real project: Online shops for local businesses
The cart is in the session; checkout runs a transaction that creates the order, adds order items, and reduces stock only if enough is available. The first checkout fails (only 3 paintings in stock), so nothing is saved; after changing the quantity it succeeds. The order is #2 because MySQL does not reuse the id used by the rolled-back attempt. Check the Database tab.
shop.php
REAL RUN
✍ Try it yourself Add a coupon field at checkout (FIRST50 = Rs 50 off) and store the discount in orders.
Add a discount column; compute it before UPDATE orders SET total.
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Practice 9 of 10 • Hard
Example 9: Coaching institute ERP dashboard
● Hard💼 Real project: A real client project: coaching centre management
The dashboard of an ERP: total students, fees collected this month, attendance percentage and a list of pending dues, each from one SQL query. A CSS bar chart shows monthly collection.
dashboard.php
REAL RUN
✍ Try it yourself Add a "Send reminder" button next to each due that records a reminder in a table.
A small POST form per row with the student id and a CSRF token; INSERT INTO reminders.
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Practice 10 of 10 • Hard
Example 10: Blog CMS with admin panel
● Hard💼 Real project: Content websites for schools, NGOs and businesses
Public pages list posts by slug; the admin (password_hash login) creates posts with automatic slugs and a CSRF-protected form. Drafts are hidden from the public. This is the core of what WordPress does.
index.phpadmin.php
REAL RUN
✍ Try it yourself Add edit and delete for posts, and an image upload for each post.
Reuse the CRUD pattern from M17 and the safe upload function from M12.
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Career
Your PHP career roadmap
🌱 Now (0-3 months)
Finish 2 capstones and deploy one
GitHub profile with READMEs
LinkedIn: "PHP Developer (Fresher), Ranchi"
Practise SQL and logic daily
💼 First work
Internships with local IT firms and startups in Ranchi, Jamshedpur, Patna, Kolkata
Small freelance sites for schools, clinics, shops
WordPress customisation jobs
🚀 Grow (6-18 months)
Laravel + REST APIs
Git teamwork, code reviews
Basic Linux server, deployment
JavaScript (fetch) or Vue/React for front ends
🏆 Roles
PHP / Laravel Developer
Full-stack Developer
WordPress Developer
Back-end / API Developer
Remote roles via LinkedIn, Upwork, company sites
Hackathons and communityJoin college hackathons, Smart India Hackathon (team entries), and online PHP/Laravel communities. Build in public: post your project progress weekly.
Interview topics from this courseOOP and interfaces, SQL joins and GROUP BY, prepared statements, sessions vs cookies, password hashing, REST status codes, PHP 8 features (match, enums, readonly, named arguments).
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Congratulations!
Certificate of Completion
BRAINBIT INFOTECH, RANCHI
Certificate of Completion
This is to certify that
Your Name Here
has successfully completed the Complete PHP 8.3 Course (Beginner to Advanced) 20 modules • 200 practical examples • about 91 class hours
Date: ____________
🏅
Nandan Kumar Founder & Head of Training
Click the name and date to edit, then print.
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Check your understanding
Quick Quiz
Click an answer. Wrong answers shake; the right one turns green and explains why.
Q1. Where should database passwords live in a project?
✔ Commit .env.example with blank values instead.
Q2. What should display_errors be on a live site?
✔ Visitors must never see paths, SQL or stack traces.
Q3. What prevents two people booking the same bed at the same moment?
✔ The row lock makes the second booking wait, then see the clash.
🎯
Your score: 0 / 3 (first try counts)
Answer all questions. Discuss any wrong answer with your partner before moving on.
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
M20Module summary
Recap: Capstone Projects, Deployment & Career
What you learned in M20
✔Pick a capstone at your level; plan users, pages, tables, rules and security first.
✔Commit often; a clear README with screenshots and setup steps.
✔Deploy: PHP 8.3 on hosting, new DB user, import SQL, upload files, update config.
✔Production: display_errors Off, logs on, HTTPS, backups, strong admin passwords.
✔Learn Laravel next: it automates everything you built by hand.
✔Build, deploy, share. Your projects are your CV.
🏆
Module 20 complete!
You practised 10 real examples.
👉 Coming next
Congratulations on completing the course! Keep building: one small feature every day.
Complete PHP 8.3 Course | Part 5 | Capstone Projects, Deployment & Career
1 / 1
All slides: Part 5 - Professional PHP & Projects (press M or Esc to close)