Application
An application is a software program designed to perform specific tasks for end users. PHP applications can take many forms: web applications served over HTTP, command-line tools, background daemons, REST APIs, batch-processing scripts, etc.
PHP applications are typically structured around a framework or architecture pattern, like MVC, ADR, hexagonal architecture, etc. and a dependency-injection container. The entry point is usually a single index.php for web apps, or a CLI script invoked via the shell.
PHP applications excel at connecting to various sources of information, to collect, process and store data.
<?php
declare(strict_types=1);
// Bootstrap the application
require __DIR__ . '/vendor/autoload.php';
// Route incoming HTTP request
$uri = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
$router = new Router();
$router->get('/', [HomeController::class, 'index']);
$router->get('/about', [AboutController::class, 'index']);
$response = $router->dispatch($method, $uri);
$response->send();
?>
See Also
Related
- Terminal User Interface (TUI)
- Command Line Interface (CLI)
- Desktop Application
- Mobile Application
- Web Application
- Model - View - Controller (MVC)
- Architectural Decision Record (ADR)
- REST API
- Application Programming Interface (API)
- GraphQL
- gRPC (Google Remote Procedure Call)
- Software-as-a-Service (SAAS)
- PaaS
- IaaS
- Microservice
- Monolith
- Single Page Application (SPA)
- Content Management System (CMS)
- NativePHP
- Hexagonal Architecture
- Clean Architecture