Shopware is a modular e-commerce system from Germany that allows you to create and manage online stores. It’s designed for both small retailers and large enterprises, known for its flexibility, scalability, and modern technology.
Developer: Shopware AG (founded in 2000 in Germany)
Technology: PHP, Symfony framework, API-first approach
Current Version: Shopware 6 (since 2019)
Open Source: Yes, with paid extensions available
Headless Ready: Yes, supports headless commerce via APIs
Product Management: Variants, tier pricing, media, SEO tools
Sales Channels: Web shop, POS, social media, marketplaces
Content Management: Built-in CMS ("Shopping Experiences")
Payments & Shipping: Many integrations (e.g. PayPal, Klarna)
Multilingual & Multi-Currency Support
B2B & B2C capabilities
App System & API for custom extensions
Startups (free Community Edition available)
SMEs and mid-sized businesses
Enterprise clients with complex needs
Very popular in the DACH region (Germany, Austria, Switzerland)
Made in Germany → GDPR-compliant
Highly customizable
Active ecosystem & community
Scalable for growing businesses
A Prepared Statement is a programming technique, especially used when working with databases, to make SQL queries more secure and efficient.
It consists of two steps:
Prepare the SQL query with placeholders
Example in SQL:
SELECT * FROM users WHERE username = ? AND password = ?
(Some languages use :username
or other types of placeholders.)
Bind parameters and execute
The real values are bound later, for example:
$stmt->bind_param("ss", $username, $password);
$stmt->execute();
✅ Protection against SQL injection:
User input is treated separately and safely, not directly inserted into the SQL string.
✅ Faster with repeated use:
The SQL query is parsed once by the database server and can be executed multiple times efficiently (e.g., in loops).
$conn = new mysqli("localhost", "user", "pass", "database");
$stmt = $conn->prepare("SELECT * FROM users WHERE email = ?");
$stmt->bind_param("s", $email); // "s" stands for string
$email = "example@example.com";
$stmt->execute();
$result = $stmt->get_result();
A Prepared Statement separates SQL logic from user input, making it a secure (SQL Injection) and recommended practice when dealing with databases.
PDO stands for PHP Data Objects and it's a database abstraction layer in PHP. It provides an object-oriented interface to access different types of databases—such as MySQL, PostgreSQL, or SQLite—without needing to change much of your code.
✅ Consistent API
Same code style regardless of which database you use.
✅ Prepared Statements
Helps prevent SQL injection via bound parameters:
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = :id");
$stmt->execute(['id' => $userId]);
✅ Transactions Support
Great for use cases like banking systems or other operations that need rollback/commit.
✅ Exception-based Error Handling
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
✅ Easy Database Switching
Switching from MySQL to PostgreSQL? Usually only the DSN and driver need to be changed.
$dsn = 'mysql:host=localhost;dbname=testdb;charset=utf8mb4';
$user = 'root';
$pass = '';
try {
$pdo = new PDO($dsn, $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully!";
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}
PDO is the recommended way to work with databases in modern PHP applications—especially for its security, flexibility, and ease of use.
An Entity Manager is a core component of ORM (Object-Relational Mapping) frameworks, especially in Java (JPA – Java Persistence API), but also in other languages like PHP (Doctrine ORM).
Persisting:
Finding/Loading:
Retrieves an object by its ID or other criteria.
Example: $entityManager->find(User::class, 1);
Updating:
Tracks changes to objects and writes them to the database (usually via flush()
).
Removing:
Deletes an object from the database.
Example: $entityManager->remove($user);
Managing Transactions:
Begins, commits, or rolls back transactions.
Handling Queries:
Executes custom queries, often using DQL (Doctrine Query Language) or JPQL.
The Entity Manager tracks the state of entities:
managed (being tracked),
detached (no longer tracked),
removed (marked for deletion),
new (not yet persisted).
$user = new User();
$user->setName('Max Mustermann');
$entityManager->persist($user); // Mark for saving
$entityManager->flush(); // Write to DB
The Entity Manager is the central component for working with database objects — creating, reading, updating, deleting. It abstracts SQL and provides a clean, object-oriented way to interact with your data layer.
Doctrine DBAL (Database Abstraction Layer) is a PHP library that provides an abstraction layer for database access. It is part of the Doctrine project (a popular ORM for PHP), but it can be used independently of the ORM.
Doctrine DBAL offers a unified API to interact with different databases (such as MySQL, PostgreSQL, SQLite, etc.) without writing raw SQL specific to each database system.
Easily configure and manage connections to various database systems.
Supports connection pooling, transactions, and more.
Build SQL queries programmatically using an object-oriented API:
$qb = $conn->createQueryBuilder();
$qb->select('u.id', 'u.name')
->from('users', 'u')
->where('u.age > :age')
->setParameter('age', 18);
$stmt = $qb->executeQuery();
Database Independence
The same code works with different database systems (e.g., MySQL, PostgreSQL) with minimal changes.
Schema Management
Tools to create, update, and compare database schemas.
Useful for migrations and automation.
Data Type Conversion
Automatically converts data between PHP types and database-native types.
use Doctrine\DBAL\DriverManager;
$conn = DriverManager::getConnection([
'dbname' => 'test',
'user' => 'root',
'password' => '',
'host' => 'localhost',
'driver' => 'pdo_mysql',
]);
$result = $conn->fetchAllAssociative('SELECT * FROM users');
You might choose DBAL without ORM if:
You want full control over your SQL.
Your project doesn't need complex object-relational mapping.
You're working with a legacy database or custom queries.
Doctrine DBAL is a powerful tool for clean, portable, and secure database access in PHP. It sits between raw PDO usage and a full-featured ORM like Doctrine ORM, making it ideal for developers who want abstraction and flexibility without the overhead of ORM logic.
Perl Compatible Regular Expressions (PCRE) are a type of regular expression syntax and engine that follows the powerful and flexible style of the Perl programming language. They offer advanced features that go beyond the basic regular expressions found in many older systems.
Perl was one of the first languages to introduce highly expressive regular expressions. The PCRE library was created to bring those capabilities to other programming languages and tools, including:
Python (similar via the re
module)
JavaScript (with slight differences)
pcregrep
(a grep version supporting PCRE)
Editors like VS Code, Sublime Text, etc.
✅ Lookahead & Lookbehind:
(?=...)
– positive lookahead
(?!...)
– negative lookahead
(?<=...)
– positive lookbehind
(?<!...)
– negative lookbehind
✅ Non-greedy quantifiers:
*?
, +?
, ??
, {m,n}?
✅ Named capturing groups:
(?P<name>...)
or (?<name>...)
✅ Unicode support:
\p{L}
matches any kind of letter in any language
✅ Assertions and anchors:
\b
, \B
, \A
, \Z
, \z
✅ Inline modifiers:
(?i)
for case-insensitive
(?m)
for multiline matching, etc.
(?<=\buser\s)\w+
This expression matches any word that follows "user " using a lookbehind assertion.
PCRE are like the "advanced edition" of regular expressions — highly powerful, widely used, and very flexible. If you're working in an environment that supports PCRE, you can take advantage of rich pattern matching features inspired by Perl.
Memcached is a distributed in-memory caching system commonly used to speed up web applications. It temporarily stores frequently requested data in RAM to avoid expensive database queries or API calls.
Key-Value Store: Data is stored as key-value pairs.
In-Memory: Runs entirely in RAM, making it extremely fast.
Distributed: Supports multiple servers (clusters) to distribute load.
Simple API: Provides basic operations like set
, get
, and delete
.
Eviction Policy: Uses LRU (Least Recently Used) to remove old data when memory is full.
Caching Database Queries: Reduces load on databases like MySQL or PostgreSQL.
Session Management: Stores user sessions in scalable web applications.
Temporary Data Storage: Useful for API rate limiting or short-lived data caching.
Memcached: Faster for simple key-value caching, scales well horizontally.
Redis: Offers more features like persistence, lists, hashes, sets, and pub/sub messaging.
sudo apt update && sudo apt install memcached
sudo systemctl start memcached
It can be used with PHP or Python via appropriate libraries.
The Whoops PHP library is a powerful and user-friendly error handling tool for PHP applications. It provides clear and well-structured error pages, making it easier to debug and fix issues.
✅ Beautiful, interactive error pages
✅ Detailed stack traces with code previews
✅ Easy integration into existing PHP projects
✅ Support for various frameworks (Laravel, Symfony, Slim, etc.)
✅ Customizable with custom handlers and loggers
You can install Whoops using Composer:
composer require filp/whoops
Here's a simple example of how to enable Whoops in your PHP project:
require 'vendor/autoload.php';
use Whoops\Run;
use Whoops\Handler\PrettyPageHandler;
$whoops = new Run();
$whoops->pushHandler(new PrettyPageHandler());
$whoops->register();
// Trigger an error (e.g., calling an undefined variable)
echo $undefinedVariable;
If an error occurs, Whoops will display a clear and visually appealing debug page.
You can extend Whoops by adding custom error handling, for example:
use Whoops\Handler\CallbackHandler;
$whoops->pushHandler(new CallbackHandler(function ($exception, $inspector, $run) {
error_log($exception->getMessage());
}));
This version logs errors to a file instead of displaying them.
Whoops is mainly used in development environments to quickly detect and fix errors. However, in production environments, it should be disabled or replaced with a custom error page.
Twig is a powerful and flexible templating engine for PHP, commonly used in Symfony but also in other PHP projects. It helps separate logic from presentation and offers many useful features for frontend development.
{{ }}
)Twig uses double curly braces to output variables:
<p>Hello, {{ name }}!</p>
→ If name = "Max"
, the output will be:
"Hello, Max!"
{% %}
)Twig supports if-else statements, loops, and other control structures.
{% if user.isAdmin %}
<p>Welcome, Admin!</p>
{% else %}
<p>Welcome, User!</p>
{% endif %}
Loops (for
)
<ul>
{% for user in users %}
<li>{{ user.name }}</li>
{% endfor %}
</ul>
Twig supports "Base Layouts", similar to Laravel's Blade.
base.html.twig
)<!DOCTYPE html>
<html>
<head>
<title>{% block title %}My Page{% endblock %}</title>
</head>
<body>
<header>{% block header %}Default Header{% endblock %}</header>
<main>{% block content %}{% endblock %}</main>
</body>
</html>
Child Template (page.html.twig
)
{% extends 'base.html.twig' %}
{% block title %}Homepage{% endblock %}
{% block content %}
<p>Welcome to my website!</p>
{% endblock %}
→ The blocks override the default content from the base template.
You can include reusable components like a navbar or footer:
{% include 'partials/navbar.html.twig' %}
Twig provides many filters to format content:
Filter | Beispiel | Ausgabe |
---|---|---|
upper |
`{{ "text" | upper }}` |
lower |
`{{ "TEXT" | lower }}` |
length |
`{{ "Hallo" | length }}` |
date |
`{{ "now" | date("d.m.Y") }}` |
Twig automatically escapes HTML to prevent XSS attacks:
{{ "<script>alert('XSS');</script>" }}
→ Outputs: <script>alert('XSS');</script>
To output raw HTML, use |raw
:
{{ "<strong>Bold</strong>"|raw }}
Model-View-Controller (MVC) is a software architecture pattern that divides an application into three main components:
✔ Better maintainability through a clear separation of concerns.
✔ Reusability of components.
✔ Easy testability since logic is separated from the interface.
✔ Flexibility, as different views can be used for the same model.
MVC is widely used in web and desktop applications, including: