# PHP Notebooks

<div align="right">

[![Python CI](https://github.com/SagarBiswas-MultiHAT/PHP-Notebooks/actions/workflows/python-ci.yml/badge.svg)](https://github.com/SagarBiswas-MultiHAT/PHP-Notebooks/actions/workflows/python-ci.yml)
&nbsp;
[![Deploy Pages](https://github.com/SagarBiswas-MultiHAT/PHP-Notebooks/actions/workflows/deploy-pages.yml/badge.svg)](https://github.com/SagarBiswas-MultiHAT/PHP-Notebooks/actions/workflows/deploy-pages.yml)
&nbsp;
[![Release](https://img.shields.io/github/v/release/SagarBiswas-MultiHAT/PHP-Notebooks?label=release&color=blue)](https://github.com/SagarBiswas-MultiHAT/PHP-Notebooks/releases)
&nbsp;
[![Website](https://img.shields.io/website?down_color=lightgrey&down_message=down&up_message=live&url=https%3A%2F%2Fsagarbiswas-multihat.github.io%2Fphp-notebooks%2F)](https://sagarbiswas-multihat.github.io/php-notebooks/)
&nbsp;
[![Last Commit](https://img.shields.io/github/last-commit/SagarBiswas-MultiHAT/PHP-Notebooks)](https://github.com/SagarBiswas-MultiHAT/PHP-Notebooks/commits/main)
&nbsp;

</div>

PHP Notebooks is a curated learning repository for readers who want a clean path from PHP fundamentals to practical web-development topics such as validation, sessions, file handling, database integration, MVC, AJAX, and JSON.

The repository is built around seven PDF handbooks and two companion projects. Each handbook focuses on one stage of the learning journey, and the repository now includes a GitHub Pages site, automated repository validation, and contributor guidance so the material is easier to browse, publish, and maintain.

Live site: https://sagarbiswas-multihat.github.io/php-notebooks/

## What You Will Find Here

- Seven topic-focused PDF notebooks that form a progressive PHP learning path.
- Two GitHub projects that connect the theory to working codebases.
- A GitHub Pages website for browsing the collection visually.
- GitHub Actions workflows for repository validation and site deployment.
- Contribution and security guidance for long-term maintenance.

<div align="center">

## Repository Structure

| Path | Purpose |
| --- | --- |
| [README.md](README.md) | Complete repository guide and learning map |
| [index.html](index.html) | GitHub Pages landing page |
| [styles.css](styles.css) | Visual design for the site |
| [script.js](script.js) | Notebook catalog rendering and filtering |
| [.github/workflows/python-ci.yml](.github/workflows/python-ci.yml) | Repository quality checks |
| [.github/workflows/deploy-pages.yml](.github/workflows/deploy-pages.yml) | GitHub Pages deployment workflow |
| [scripts/validate_repository.py](scripts/validate_repository.py) | Validation logic used by CI |
| [CONTRIBUTING.md](CONTRIBUTING.md) | Contribution workflow |
| [SECURITY.md](SECURITY.md) | Security reporting guidance |

</div>

## Learning Path At A Glance

| Part | Notebook | Primary Focus | Best For |
| --- | --- | --- | --- |
| 1 | [Introduction to PHP](1.%20Introduction%20to%20PHP.pdf) | Language basics, syntax, control flow, OOP, files | First-time PHP learners |
| 2 | [HackProof: PHP Form Validation](2.%20HACKPROOF%20%E2%80%93%20PHP%20FROM%20VALIDATION.pdf) | Secure form handling, sanitization, XSS prevention | Readers building safe input flows |
| 3 | [PHP Session and Cookie](3.%20PHP%20Session%20and%20Cookie.pdf) | State management, authentication patterns, persistence | Readers building login or session-based apps |
| 4 | [Data Access Using PHP](4.%20DATA%20ACCESS%20USING%20PHP.pdf) | Files, XML, reusable includes, uploads | Readers working with data beyond databases |
| 5 | [PHP and MySQL Introduction](5.%20PHP%20and%20MySQL%20Introduction%E2%80%8B.pdf) | Database connectivity, CRUD, prepared statements | Readers moving into data-driven applications |
| 6 | [PHP MVC Handbook](6.%20PHP_MVC_HandBook.pdf) | MVC architecture, separation of concerns, mini project | Readers learning project structure |
| 7 | [AJAX and JSON](7.%20AJAX%20%26%20JSON.pdf) | Async requests, APIs, response handling, JSON workflows | Readers building more interactive apps |

## Detailed Notebook Guide

### 1. [Introduction to PHP](1.%20Introduction%20to%20PHP.pdf)

This notebook establishes the core language model and gives a beginner enough context to read and write small PHP programs confidently.

Topics covered:
- What PHP is and where it fits in web development.
- Installing PHP with XAMPP.
- Writing the first script and understanding syntax rules.
- Variables, data types, output functions, conditions, and loops.
- Functions, classes, objects, constructors, and methods.
- File handling, modularization with include and require, and basic exception handling.

Why it matters:
This notebook is the foundation for everything else in the repository. If a reader skips it, later notebooks will feel disconnected.

### 2. [HackProof: PHP Form Validation](2.%20HACKPROOF%20%E2%80%93%20PHP%20FROM%20VALIDATION.pdf)

This notebook focuses on one of the most important practical skills in backend development: never trusting user input.

Topics covered:
- Form handling basics and the difference between GET and POST.
- Why validation matters for integrity, security, and user experience.
- Server-side validation patterns using PHP and OOP.
- XSS prevention through sanitization and safe output encoding.
- How client-side validation can be bypassed.
- PHP filter functions and common sanitization helpers.

Why it matters:
Readers who plan to build login forms, registration flows, checkout forms, or any data-entry feature should treat this notebook as required reading.

### 3. [PHP Session and Cookie](3.%20PHP%20Session%20and%20Cookie.pdf)

This notebook explains how PHP applications preserve state across requests.

Topics covered:
- Why HTTP is stateless.
- Creating, reading, and deleting cookies.
- Detecting cookie support.
- Starting, updating, and destroying PHP sessions.
- Login, dashboard, and logout workflow design.
- Deciding when cookies are appropriate and when sessions are safer.

Why it matters:
This material sits directly behind authentication systems, shopping carts, multi-step forms, and persistent preferences.

### 4. [Data Access Using PHP](4.%20DATA%20ACCESS%20USING%20PHP.pdf)

This notebook broadens the reader's view of data access beyond relational databases.

Topics covered:
- Reading and writing text files.
- File modes and safe write patterns.
- Loading and generating XML with SimpleXML.
- Building reusable code with include and require.
- Handling uploads with correct PHP configuration.
- Inspecting the $_FILES array and moving uploaded files safely.

Why it matters:
Readers learn how PHP works with common file-based workflows and how to avoid basic upload mistakes.

### 5. [PHP and MySQL Introduction](5.%20PHP%20and%20MySQL%20Introduction%E2%80%8B.pdf)

This notebook introduces database-backed application development.

Topics covered:
- MySQL fundamentals and relational database concepts.
- Connecting PHP to MySQL with MySQLi and PDO.
- Creating databases and tables.
- Secure inserts with prepared statements.
- Transactions and multiple-record workflows.
- A practical product-management example.
- SQL injection prevention and production-safe error handling.

Why it matters:
This is the bridge from static learning exercises to applications that persist real data.

### 6. [PHP MVC Handbook](6.%20PHP_MVC_HandBook.pdf)

This notebook introduces architectural thinking and a more maintainable way to organize PHP projects.

Topics covered:
- The purpose of MVC and the responsibilities of model, view, and controller.
- Advantages and tradeoffs of MVC.
- How popular PHP frameworks map to MVC ideas.
- A student-management mini-project with PDO, controllers, models, views, routing, SQL setup, and styling.

Why it matters:
This notebook shifts the reader from isolated scripts to structured application design.

### 7. [AJAX and JSON](7.%20AJAX%20%26%20JSON.pdf)

This notebook covers asynchronous browser-server communication and structured data exchange.

Topics covered:
- What AJAX is and how it works.
- The role of XMLHttpRequest.
- GET and POST requests.
- Response lifecycle, status codes, and response headers.
- JSON parsing and generation.
- Best practices for async requests and error handling.

Why it matters:
Readers learn how to build web experiences that feel responsive rather than page-refresh driven.

## Projects Connected To The Notebooks

### 1. [SecurePay_E-Wallet-V1](https://github.com/SagarBiswas-MultiHAT/SecurePay_E-Wallet-V1)

This project is a strong practical companion to the validation, sessions, and database notebooks. It is most relevant for readers interested in authentication flows, financial-data handling, form safety, and real application structure.

### 2. [Student-Management-MVC-Learning-Project](https://github.com/SagarBiswas-MultiHAT/Student-Management-MVC-Learning-Project)

This project is the clearest hands-on extension of the MVC notebook. It helps readers connect the design concepts to a working CRUD application with separation between routing, models, controllers, and views.

## Recommended Reading Order

1. Start with the PHP fundamentals notebook.
2. Move into secure input handling and state management.
3. Learn file-based data access before database-backed development.
4. Add database work with MySQL.
5. Study MVC once basic PHP and database ideas feel comfortable.
6. Finish with AJAX and JSON to build richer frontend-backend interactions.

## GitHub Pages Website

The repository includes a custom GitHub Pages site in [index.html](index.html) with styling in [styles.css](styles.css) and catalog logic in [script.js](script.js).

The site is designed to help visitors:
- See the full notebook collection quickly.
- Filter notebooks by topic area.
- Open PDF handbooks directly.
- Jump to related GitHub projects.
- Understand the learning path without reading the repository tree first.

## Automation And Quality Checks

The repository uses GitHub Actions to protect quality and publishing workflows.

- [python-ci.yml](.github/workflows/python-ci.yml) validates that the core files, workflows, PDF assets, README coverage, and project links are present.
- [deploy-pages.yml](.github/workflows/deploy-pages.yml) publishes the static site to GitHub Pages from the repository contents.

## How To Use This Repository

1. Read this README once from top to bottom.
2. Open the notebook that matches your current skill level.
3. Use the GitHub Pages site if you want a faster visual overview.
4. Explore the linked projects when you want to see the concepts applied in code.

## Contributing

If you want to improve summaries, fix broken links, refine the site, or expand the learning path, read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.

## Security

If you notice an unsafe example, sensitive disclosure, or a misleading security recommendation, report it through the process in [SECURITY.md](SECURITY.md).