Glossary

Web Developer Dictionary

Визначення технічних термінів з PHP, DevOps, MySQL та AI — з прикладами коду та поясненнями простою мовою.

228 terms
27 letters
P
Pagination
Pagination splits a large dataset into pages, delivering it to the client in chunks. Returning 100,000 rows in a single query is a disaster for memory and network. Pagination solves this.Two approachesOffset / Limit — SELECT ... LIMIT 20 OFFSET 200. Simple, but slows on large offsets: the DB still scans part of the table to skip the first 200 rowsCursor-based (Keyset) — WHERE id > {last_id} LIMIT 20. Stable speed regardless of pagination depth. Recommended for large tables and real-time feedsAPI responseReturn metadata alongside data: current page, total items, links to next/previous. For cursor-based — a next cursor token.{ "data": [...], "meta": { "total": 1240, "per_page": 20, "next_cursor": "abc123" } }
Pass by Reference (&)
In PHP, variables are passed by value by default: the function receives a copy. When passed by reference (&$var), the function works with the original variable. Example function addTen(int $n): void { $n += 10; // modifies the local copy only } function addTenRef(int &$n): void { $n += 10; // modifies the original } $x = 5; addTen($x); // $x = 5 addTenRef($x); // $x = 15 Objects — a special case Objects in PHP are passed by handle (a pointer to the object), not by value or reference. Modifying an object's properties inside a function is visible outside. But $obj = new OtherClass() is not (it replaces the local handle only). When to use Rarely needed in modern code. Prefer returning a new value from the function rather than mutating an argument. Justified for sort()-style functions or large structures to avoid copying.
PHP Attributes
Attributes (PHP 8.0) are structured metadata added to classes, methods, properties, and parameters. They replaced docblock annotations (@Route, @Inject) with native syntax that is validated by static analysis. Syntax #[Attribute] class Route { public function __construct( public string $path, public string $method = 'GET', ) {} } #[Route('/users', 'GET')] #[Middleware(AuthMiddleware::class)] class UserController { #[Route('/users/{id}')] public function show(int $id): Response { ... } } Reading attributes $ref = new ReflectionClass(UserController::class); $attrs = $ref->getAttributes(Route::class); foreach ($attrs as $attr) { $route = $attr->newInstance(); // Route('/users', 'GET') } Where used DI containers, routers, ORM mapping, validators, serialisers. Symfony and Doctrine use attributes extensively instead of XML/YAML configuration.
PHP Magic Methods
Magic methods are special double-underscore methods (__method) that PHP calls automatically during certain operations on an object. They allow you to override the default behaviour of a class.Most important__construct() — called on new ClassName()__destruct() — when the object is destroyed__get($name) / __set($name, $value) — access to non-existent or protected properties__call($name, $args) — calling a non-existent method__toString() — object-to-string conversion__invoke() — calling the object like a function: $obj()__clone() — after object cloning__serialize() / __unserialize() — serialisation controlCautionMagic methods are slower than regular ones. __get/__set hinder static analysis — the IDE cannot "see" the properties. Use them only where dynamic behaviour is genuinely needed.
PHP-FPM
PHP-FPM (FastCGI Process Manager) is a PHP process manager that maintains a pool of workers for handling PHP requests. Nginx or Apache forward requests to PHP-FPM via FastCGI; it executes the script and returns a response.Pools and workersPHP-FPM starts N child processes (workers). Each worker handles one request at a time. Three pool management modes:static — fixed number of workersdynamic — count between min and max based on loadondemand — workers start on request and stop after idle timeKey parameterspm.max_children — maximum concurrent requests. Formula: RAM / (~30 MB per worker)request_terminate_timeout — kill a worker if a request runs longer than N secondspm.max_requests — restart a worker after N requests (prevents memory leaks)
Polymorphism
Polymorphism is the ability of objects from different classes to respond to the same method call in different ways. Code calling the method through an interface or parent class does not know — and does not need to know — which subclass will execute the logic. Example interface Shape { area(): float; } class Circle implements Shape { area(): float { return M_PI * $this->r ** 2; } } class Square implements Shape { area(): float { return $this->side ** 2; } } function printArea(Shape $s): void { echo $s->area(); // does not know whether it is a circle or square } Two types Compile-time (static) — method overloading. Limited in PHP: no true overloading, but variadic arguments exist Runtime (dynamic) — method overriding through inheritance or interfaces. Most common in PHP
Profiling
Profiling is measuring how much time and memory each part of a program consumes. It lets you find the real bottlenecks instead of guessing what to optimise. The principle: measure first, then optimise.Types of profilingCPU profiling — which function consumes the most execution timeMemory profiling — what uses the most memory, where leaks occurI/O profiling — slow SQL queries, network callsToolsPHP: Xdebug + KCacheGrind, Blackfire, TidewaysNode.js: Chrome DevTools CPU profiler, clinic.jsPython: cProfile, py-spy, memory_profilerThe 80/20 ruleTypically 20% of the code accounts for 80% of execution time. The profiler shows you that 20%. More often than not, the bottleneck turns out to be SQL queries without indexes, not the application code itself.
Prometheus and Grafana
Prometheus + Grafana is the de facto standard for monitoring cloud-native applications. Prometheus collects and stores metrics; Grafana visualises them. Together they provide a complete real-time picture of system health. Prometheus Pull model: Prometheus itself "scrapes" metrics from endpoints (/metrics) every N seconds. Its own query language: PromQL. # Prometheus metric format (text/plain) http_requests_total{method="GET",status="200"} 1234 http_request_duration_seconds{p99} 0.245 Grafana Connects to Prometheus (and 50+ other sources) to build dashboards. Supports alerting: if error rate > 1% — sends to Slack/PagerDuty. Prometheus metric types Counter — monotonically increases (request count) Gauge — can decrease (current connections, RAM) Histogram — distribution of values (latency buckets) Summary — pre-calculated percentiles
Promise / async-await
A Promise is an object representing the result of an async operation: pending, fulfilled, or rejected. async/await is syntactic sugar for working with Promises more readably.Promisefetch('/api/users') .then(res => res.json()) .then(users => console.log(users)) .catch(err => console.error(err));async/awaitasync function getUsers() { try { const res = await fetch('/api/users'); const users = await res.json(); console.log(users); } catch (err) { console.error(err); } }Promise.all vs Promise.allSettledPromise.all([p1, p2]) — waits for all; rejects if any failsPromise.allSettled([p1, p2]) — waits for all and returns results regardless of outcome
Prompt Engineering
Prompt Engineering is the art of formulating requests to an LLM to get the most accurate and useful result. The right prompt can dramatically change output quality without changing the model.Key techniquesZero-shot — a direct question with no examplesFew-shot — provide several "question → answer" examples before the main requestChain-of-Thought — ask the model to reason step by step: "explain your thinking"System prompt — set a role and context up front: "You are a senior PHP developer"Temperature — 0 for deterministic tasks (code, facts); higher for creative onesEffective prompt structureRole: "You are a technical writer"Context: "The audience is junior developers"Task: "Explain X"Format: "Answer in 3 paragraphs with a code example"
PSR Standards
PSR (PHP Standards Recommendations) is a set of community standards from PHP-FIG. They define coding conventions, autoloading, and interfaces to ensure interoperability between frameworks and libraries. Most important PSRs PSR-1 — basic coding standard: UTF-8, StudlyCaps for classes, camelCase for methods PSR-2 / PSR-12 — code style: indentation (4 spaces), braces, blank lines PSR-4 — autoloading: namespace maps to directory. The foundation of Composer's autoloader PSR-3 — Logger interface (LoggerInterface): debug, info, warning, error… PSR-7 — HTTP Message interfaces: RequestInterface, ResponseInterface PSR-11 — Container interface: ContainerInterface for DI containers PSR-14 — Event Dispatcher interface Why it matters Following PSR allows components from different frameworks (Symfony, Laravel) to interoperate. Pint and PHP-CS-Fixer automatically fix code to PSR-12.
PWA (Progressive Web App)
PWA (Progressive Web App) is a web application that uses modern browser APIs to achieve a native-like experience: install to home screen, offline operation, push notifications. One codebase instead of an iOS app, Android app, and website.Three pillars of PWAService Worker — a JavaScript file that intercepts network requests and enables resource caching for offline useWeb App Manifest — a JSON file with the app name, icons, and display settings: fullscreen mode, theme colourHTTPS — mandatory; otherwise the Service Worker will not registerLimitationsiOS Safari has limited Service Worker support. Access to hardware features (Bluetooth, NFC) requires native apps. A PWA is not published in the App Store directly (though an iOS PWA wrapper via the App Store is possible).