User Tools

Site Tools


php

This is an old revision of the document!


[[php:start|PHP]]

Setup & Tooling

Install PHP

PHP Versions

PHP CLI

PHP-FPM

Composer

composer init

composer require

composer update

Composer scripts

Autoloading

PSR-4

Namespaces

Debugging

Xdebug

error_reporting & display_errors

Coding Standards

PSR-12

PHP-CS-Fixer

Language Basics

Syntax

PHP tags (<?php ... ?>)

echo vs print

Comments

Variables

Constants (const, define)

Scope (global/local/static)

Superglobals ($_GET, $_POST...)

References (&)

Types

Scalar types

Array type

Object type

Nullable types (?T)

Union types (T1|T2)

Type juggling

declare(strict_types=1)

Operators

Comparison (== vs ===)

Null coalescing (??)

Spaceship (<=>)

Ternary (?:)

Control Flow

if/else

switch

match (PHP 8)

for/foreach/while/do-while

break/continue

Functions

Parameters & return type

Variadic (...$args)

Named arguments

Default values

Closures

use keyword (capture)

Arrow functions (fn)

Generators (yield)

Data Handling

Strings

Common string functions

Heredoc & Nowdoc

Multibyte (mbstring)

Regex (PCRE)

Arrays

Indexed vs Associative

array_map/filter/reduce

Sorting (sort/asort/ksort)

Destructuring

Spread operator (...)

DateTime

DateTimeImmutable

Timezone

format/parse

JSON

json_encode

json_decode

JSON errors

Serialization

serialize/unserialize

Serialization security

OOP (Object-Oriented Programming)

Class & Object

Properties & Methods

Visibility (public/protected/private)

Constructor (__construct)

Destructor (__destruct)

Inheritance

Override

final class/method

Polymorphism

Interfaces

Abstract class

Traits

Trait conflict resolution

Magic methods

__get / __set

__call / __callStatic

__toString

Exceptions

try/catch/finally

Custom exceptions

Attributes (PHP 8)

Reflection

Enums (PHP 8.1)

Backed enums

Design Principles

SOLID

Dependency Injection (DI)

Design Patterns

Web & HTTP

HTTP Basics

Methods (GET/POST/PUT/DELETE)

Status codes

Headers

Request/Response in PHP

Query string

Form POST

Content-Type

Sessions & Cookies

session_start

Cookie flags (HttpOnly/Secure/SameSite)

File Uploads

$_FILES

Upload security

Building API

REST

Middleware

API Auth (Bearer/JWT)

Pagination

API Versioning

Database

PDO

Prepared statements

Transactions

MySQL

Indexes

Normalization

Query Builder

ORM

Eloquent (Laravel)

Doctrine (Symfony)

Migrations

Seeding

Security

SQL Injection

Prepared statements

XSS

Escaping output

CSRF

CSRF tokens

Passwords

password_hash / password_verify

Authentication & Authorization

RBAC

Policies

CORS

HTTPS

Testing & Quality

PHPUnit

Unit vs Integration tests

Fixtures

Mocking

Static Analysis

PHPStan

Psalm

Linting

PHP_CodeSniffer

PHP-CS-Fixer

Performance

OPcache

Profiling

Xdebug profiler

Caching

Redis

Memcached

Async PHP

Swoole

ReactPHP

Frameworks

Laravel

Routing

Controllers

Middleware

Eloquent

Symfony

Services/DI Container

Routing

Slim

Deployment

Nginx + PHP-FPM

Virtual host

File permissions

Docker

Dockerfile

docker-compose

CI/CD

GitHub Actions

Monitoring

Logs

Metrics

Từ tiếng Anh khó (ghi chú nhanh)

keyword /ˈkiːwɜːrd/: từ khoá

tree /triː/: dạng cây (cấu trúc phân nhánh)

namespace /ˈneɪm.speɪs/: không gian tên (nhóm trang theo tiền tố như php:)

page /peɪdʒ/: trang

link /lɪŋk/: liên kết

click /klɪk/: bấm/nhấn

php.1766961524.txt.gz · Last modified: by phong2018